Flashcards
Exception Handling
Cards in this deck (22)
- 1What is an exception?An event which occurs DURING THE EXECUTION OF A PROGRAM that disrupts the normal flow of the program's instruction
- 2Exceptions What happens in a method when an error occurs?The method creates an object and hands it off to the runtime system
- 3Exceptions What happens to the error object that is passed off and what is the exception object called?The EXCEPTION OBJECT takes information about the error including its type, and the state of the program when the error occurred
- 4Exceptions Creating an exception object and hanging it to the runtime system is called _____ _____ _____throwing an exception
- 5After a method throws an exception, the runtime system attempts to find something to _____ ithandle
- 6The call stack What is it?The sequence of method calls that lead to the exception
- 7Handling the exception The _____ system searches the call stack for a method that contains a block of code that can handle the exception. This block of code is called the _____ _____The RUNTIME system searches the call stack for a method that contains a block of code that can handle the exception. This block of code is called the EXCEPTION HANDLER
- 8The Call Stack The search begins with the method where the error occurred and works _____ from therebackwards
- 9The Call Stack When the appropriate handler is found, the runtime system passes the exception to the handler. An exception handler is considered appropriate if ...the type of the exception object thrown matches the type that can be handled by the handler
- 10Try/Catch Catch Block What is its function?It is an exception handler and handles the type of exception indicated by its argument
- 11Try/Catch Catch Block What does it take in its parameters?The exception type that it can handle
- 12Try/Catch Catch Block The Exception type must be the name of a class that extends _____Throwable
- 13Try/Catch Catch Block The handler can refer to the exception handler with _____name
- 14Try/Catch How can you display the error details to System.out?ex{or name of exception}.printStackTrace();
- 15Exceptions To handle numbers and equations, which exception would be the best to use?java.lang.ArithmeticException
- 16Exceptions Call an ArithmeticException and name it in a catch block :catch(java.lang.ArithmeticException ex)
- 17Exceptions Call a general exception in a catch block and name it :catch(Exception ex)
- 18Exceptions Which function do you use to get the message outputted by the exception handler?ex.getMessage();
- 19Try/Catch Finally When does it execute?After all the trys and catches
- 20Try/Catch Finally Will it execute even if an unexpected exception occurs?Yes
- 21Try/Catch Finally What is an amazing function it performs?Clean of of code and resources
- 22Exceptions Which exception handles user input exceptions?InputMissmatchException
Information
- Description
- Masters Programming I Flashcards on Exception Handling, created by nhunsdale02 on 05/06/2014.
- Created by
- nhunsdale02
- Views
- 15
- Rating