Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
11 Cards in this Set
- Front
- Back
The second part of assert expression can be evaluated to everything but
|
void
|
|
Try-with-resources. When try block throws an Expression and then close() method throws an expression. Which Expression are thrown to the caller
|
First Expression (from try block). Expressions from close() method are suppressed
|
|
What is checked and unchecked exceptions?
|
The unchecked exception classes are the run-time exception classes and the error
classes. The checked exception classes are all exception classes other than the unchecked exception classes. That is, the checked exception classes are all subclasses of Throwable other than RuntimeException and its subclasses and Error and its subclasses. |
|
Assert statement second operand evaluation
|
Second operand of assert statement should evaluate to object or primitive. It cannot be void.It can be null.
|
|
How to use assert as a keyword identifier?
|
From Java 1.5 onwards, assert is treated as a keyword by default (as opposed to Java 1.4 version where it is treated as an identifier) so there is no need for -source 1.5 or 1.6 switch. If asser is identifier - use javac - source 1.3
|
|
Can you reassign variables defined in the try-with-resources statement?
|
The auto-closeable variables defined in the try-with-resources statement are implicitly final. Thus, they cannot be reassigned.
|
|
What is main restriction of multi-catch block?
|
In a multi-catch block, you cannot combine catch handlers for two exceptions that share a base- and
derived-class relationship. You can only combine catch handlers for exceptions that do not share the parent-child relationship between them. |
|
Order of execution while Exception thrown in try-with-resources block
|
In a try-with-resources statement, any catch or finally block is run after the resources declared have been closed.
|
|
Declaration of try-with-resources statement
|
The type of the resource must be specified in the try itself
|
|
The exception parameter in a multi-catch clause
|
is implicitly final
|
|
Empty catch block
|
Considered bad coding practice
|