Karteikarten
Exceptions
Karten in diesem Stapel (32)
- 1All types of exception are subclass of ...java.lang.Throwable
- 2The ... block executes regardless of whether the ... block throws an ...finally, try, exception
- 3true or false for the try block, you can define only single catch block, and multiple finally blocksfalse
- 4A finally block is used to define ... code - code that closes and releases resources, such as file handlers and database or network connectioncleanup code
- 5Is it possible to define a finally block before a catch block ?No, compilation error
- 6if a catch block returns a primitive data type, the finally block ... modify the value being returnedcan't modify
- 7if a catch block returns an object, the finally block ... modify the value being returnedcan modify
- 8Can an exception or error be rethrowen?yes
- 9True or false Unhandled exceptions thrown by an inner exception handler are passed on to the outer try-catch block to handletrue
- 10Exceptions can be divided into three categorieChecked exceptions
Unchecked exceptions (Runtime exceptions)
Errors - 11What is a checked exception ?Is an unacceptable condition foreseen by the author of the method but outside the immediate control of the code.
- 12A checked exception is s subclass of ...java.lang.Exception
- 13What is a runtime exception?is a representation of a programming error. These occur from inappropriate use of another piece of code.
- 14A Unchecked exception is a subclass of ..java.lang.RuntimeException
- 15Is a runtime exception a part of the method signature?Not always
- 16what's an error?A serious exception thrown by the JVM as a result of an error in the environment state that processes your code
- 17An error is a subclass of class ...java.lang.Error
- 18Does an error need to be a part of a method signature?N
O - 19Can you catch an Error?yes, but you shouldn't handle errors in your code
- 20java.lang.ArrayIndexOutOfBoundsException is a.. Thrown when ..Runtime exception, derived from IndexOutOfBoundsException.
When a piece of code tries to access an array out of its bounds - 21java.lang.IndexOutOfBoundsException is a.. Thrown when..Runtime exception.
When a piece of code tries to access an list using a illegal index - 22java.lang.ClassCastException is a .. Thrown when ..Runtime exception
When an object fails an IS-A test with the class type to which it's casting - 23java.lang.IllegalArgumentException is a.. Thrown when ..Runtime exception
to specify that a method has passed illegal or inappropriate arguments - 24java.lang.IllegalStateException is a .. Thrown when ..Runtime exception
a method has been invoked at an illegal or inappropriate time - 25NullPointerException is a .. Thrown when ..Runtime exception
a method or a variable with a null value is accessed - 26NumberFormatException is a .. Thrown when ..Runtime exception
an appropriate format to one of the numeric types - 27ExceptionInInitializerError is a .. Thrown when ..Error
by the JVM when a static initializer in a code throws any of RuntimeException - 28A ExceptionInInitializerError can only be caused by a ..RuntimeException
- 29Can you throw an unhandled checked exception from a static initializer ?No
- 30StackOverflowError is a .. Occurs when ..Error, derived from VirtualMachineError
when a program calls itself so many times that the memory allocated to execute the Java program "overflows" - 31NoClassDefFoundError is a .. Occurs when ..Error, derived from LinkageError
you failed to set your class path and, as a result, the JVM was unable to load the class that you wanted to access or to execute
Or
you run your application before compiling it - 32OutOfMemoryError is a .. Occurs when ..Error, derives from VirtualMachineError
When the JVM run out of memory on the heap, and the garbage collector may not be able to free memory for the JVM
Informationen
- Beschreibung
- Karteikarten am Exceptions, erstellt von alim586 am 19/06/2015.
- Erstellt von
- alim586
- Aufrufe
- 19
- Tags
- Bewertung