Question: Find the Error Chapt 10 Starting Out With Java Early Objects 6E These are Java programs that I just need to find the errors and

Find the Error Chapt 10 Starting Out With Java Early Objects 6E

These are Java programs that I just need to find the errors and list them.

I do not necessarily need the program corrected just need the errors.

1. catch (FileNotFoundException e) {

System.out.println("File not found."); }

try {

File file = new File("MyFile.txt")

Scanner inputFile = new Scanner(file); }

2. // Assume inputFile references a Scanner object. try

{ input = inputFile.nextInt();

} finally {

inputFile.close(); }

catch (InputMismatchException e) {

System.out.println(e.getMessage()); }

3. try {

number = Integer.parseInt(str); }

catch (Exception e) {

System.out.println(e.getMessage()); }

catch (IllegalArgumentException e) {

System.out.println("Bad number format."); }

catch (NumberFormatException e) {

System.out.println(str + " is not a number."); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!