Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java code 4. The following program displays the maximum of the sequence of positive integer numbers that are saved on the positive.txt. Write a java
java code
4. The following program displays the maximum of the sequence of positive integer numbers that are saved on the positive.txt. Write a java program that changes the standard message to a customized message for the exceptions that may occur in the given code. (30 pts.) public class Maximum { public static void main (String args[]) throws IOException BufferedReader ob =new BufferedReader (new FileReader("positive.txt")); // can produce FileNotFoundException int maximum = -1; String line = ob.readLine(); // can produce IOException while (line != null) { int n = Integer.parseInt(line); // can produce Number FormatException if (n > maximum) maximum = n; line = ob.readLine(); // can produce IOException} System.out.println("Maximum = + maximum); } }Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started