Help with exception catching
Hi i'm having trouble doing the try catch in my methods.
Could someone give me some pointers to where I can put them?
The method is written in another class, and I'm using eclipse.
public static void openFlight()
System.out.print("\nEnter id of Flight to open: ");
FlightID = sc.nextLine();
Flight = getFlight(FlightID);
if (Flight == null)
System.out.printf("\nError - Flight %s not found!\n", FlightID);
result = Flight.open();
if (result == true)
System.out.printf("\nFlight %s opened for boarding.\n", FlightID);
"\nError Flight %s cannot be opened for boarding!\n",
I want it to be able to throw an exception if the flight cannot be opened, but i've tried putting it in but keeps erroring , so i'm a bit lost.
Really appreciate it.