Question: //Please help me!!!! package debugmeone; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; /* * The output should be: * * run: * Error - File Not

//Please help me!!!!

package debugmeone;

import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner;

/* * The output should be: * * run: * Error - File Not Found: accountrecords.txt * BUILD SUCCESSFUL (total time: 1 seconds) */ public class ReadTextFile {

private Scanner input; // Ignore the hint given by NetBeans

public void openFile() { try { input = new Scanner(new File("accountrecords.txt")); } catch (Exception e) { System.out.println("Something bad just happened here."); } catch (FileNotFoundException fnfe) { System.out.println("Error - File Not Found: accountrecords.txt"); } } }

---------

package debugmeone;

/* * Nothing to debug in this file. */ public class ReadTextFileTest { public static void main(String[] args) { ReadTextFile data = new ReadTextFile(); data.openFile(); } }

---------------------------------------------------------------------------------------------------------------------------------------------

package debugmetwo; /* * This is a custom exception. All custom exceptions that you would create * must extend (i.e. inherit) from class Exception. * * There is no need to debug this file. */ public class EagleLandingException extends Exception { public EagleLandingException(String msg) { super(msg); } }

---------

package debugmetwo; /* * You will need to debug this file. * * The output should be: * * run: * There is a problem with the Eagle! * Java Result: 9999 * BUILD SUCCESSFUL (total time: 0 seconds) */ public class ThrowEagleExceptionTest { public static void main(String[] args) { try { EagleLanding(); } catch(EagleLandingException badEagle) { System.out.printf("%s ", badEagle.getMessage()); System.exit(9999); } }

private static void EagleLanding() { EagleLandingException("There is a problem with the Eagle!"); } }

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!