Flashcards
Exception Handling
Flashcards do conjunto (34)
- 1An exception is an indication of a _____ that occurs during the execution of a programproblem
- 2Exception Handling enables you to create applications that can _____ exceptionsresolve
- 3Exception handling allows a program to keep running as if no significant _____ has been encountered.problem
- 4Try Catch An uncaught exception is one where there is no _____ block to catch the error and may result in program terminationcatch
- 5Try Catch Flow After the exception has been handled, the program resumes after the last _____ block. This is known as the _____ _____ of _____ _____catch
termination model of exception handling - 6What is the difference between the try block and the try statement?The try block only contains what is in the block of curly brackets but the try statement includes all of the code, including try, catch, and finally code
- 7Variable Scope Are variables declared in the try block available in the catch block?No
- 8Checked vs Unchecked Exceptions The Java compiler enforces a catch-or-declare requirement for _____ exceptionsChecked
- 9Checked vs Unchecked Exceptions An exception's _____ type determines whether it's checked or uncheckedtype
- 10Checked vs Unchecked Exceptions All exception types that are direct or indirect subclasses of class RuntimeException are _____ exceptionsunchecked
- 11Checked vs Unchecked Exceptions Checked Represent invalid conditions in areas _____ the immediate control of the programoutside
- 12Checked vs Unchecked Exceptions Checked Are subclasses of the _____ classException
- 13Checked vs Unchecked Exceptions Checked All classes that are inherited from class Exception but not class _____ are considered to be checked exceptionsRuntime
- 14Checked vs Unchecked Exceptions Checked A method is required to somehow _____ a checked excpetionhandle
- 15Checked vs Unchecked Exceptions Checked If the complier sees that a checked exception has occurred, it _____ it or declares it in a _____ clausecaught it or declares it in a throws clause
- 16Checked vs Unchecked Exceptions Checked They will either add a _____/_____ block or add a _____ declarationtry/catch or throw
- 17Checked vs Unchecked Exceptions Unchecked The Java compiler (does/does not) check to determine whether an unchecked exception has been caught or declareddoes NOT
- 18Checked vs Unchecked Exceptions Unchecked These can be prevented by _____ coding. e.g. Validating a variable _____ it is used to perform an actionproper
before - 19Checked vs Unchecked Exceptions Unchecked Unchecked Exceptions (are/are not) required to be listed in a methods throw clause. Even if they are, it is not required that such exceptions be caught by an application.ARE NOT
- 20Checked vs Unchecked Exceptions Obtaining data from an Exception Object Exceptions derive from the _____ classThrowable
- 21Checked vs Unchecked Exceptions Obtaining data from an Exception Object Class Throwable offers _____ method that outputs the stack to the standard error streamprintStackTrace()
- 22Checked vs Unchecked Exceptions Obtaining data from an Exception Object Class Throwable getStackTrace- What does it do?Retrieves the stack trace information that might be printed by printStackTrace()
- 23Checked vs Unchecked Exceptions Obtaining data from an Exception Object Class Throwable getMessage() - What does it do?Returns the descriptive String store in an exception
- 24Checked vs Unchecked Exceptions Finally Block An ideal place to release _____ acquired in a try block, which helps eliminate resource leaksresources
- 25Checked vs Unchecked Exceptions Catching more than 1 type of Exception What is the exception?InputMistmatchException
- 26Using the Throws Clause It specifies the _____ that the method throwsexceptions
- 27Try-with try(Scanner sc = new Scanner(System.in);) What does this do?Closes the scanner on completion of the try block
- 28Throws If a method is called and the throws clause stated for that method is used then the exception is thrown back to the _____ which called itmethod
- 29Creating Your Own Exceptions A new exception must extend the _____ classException
- 30Rethrowing Exceptions Exceptions are rethrown when a catch block decides it cannot _____ that exceptionprocess
- 31Rethrowing Exceptions Rethrowing Exceptions defers the exception handling to _____ catch blockanother
- 32Logging What is this?Writing log messages during the execution of a program to a central place
- 33Logging Which package is it contained in?java.util.logging
- 34Logging Which class is it contained in?Logger
Informações
- Descrição
- Masters of Science Programming 2 FlashCards sobre Exception Handling, criado por Nathan Hunsdale em 02-06-2014.
- Criado por
- Nathan Hunsdale
- Visualizações
- 15
- Avaliação