solution 2025
From which problems is it possible for a program to recover - correct answer
✔Exceptions
Both class Error and class Exception are children of this parent: - correct
answer ✔Throwable
Is a program required to catch all exceptions that might happen? - correct
answer ✔No. You can write a program to catch just the exceptions you want.
What type of exception is thrown by nextInt() if it gets illegal data - correct
answer ✔InputMismatchException
try{} block - correct answer ✔- Some will never throw an exception.
- may throw several types of exception.
- must appear before the catch{} blocks.
- can contain loops or branches.
catch{} block - correct answer ✔- There can be several " " blocks in a
try/catch structure.
- The " " block for a child exception class must PRECEDE that of a parent
exception class.
, - If there is no " " block there must be a finally{} block
What happens in a method if an exception is thrown in a try{} block and there
is NO MATCHING catch{} block? - correct answer ✔The method throws the
exception to its caller, exactly if there were no try{} block.
How many finally{} blocks may there be in a try/catch structure? - correct
answer ✔There can be zero or one, following the last catch{} block.
When is a finally{} block executed? - correct answer ✔Always after execution
has left a try{} block, no matter for what reason.
What is a method's signature? - correct answer ✔It is the name of the
method and the data types of its parameters.
What must be true if a child of an abstract parent class does not override all of
the parent's abstract methods - correct answer ✔The child class itself must
be declared to be abstract.
What must a non-abstract child do about an abstract method in its parent
class? - correct answer ✔A child must override an abstract method inherited
from its parent by defining a method with the same signature and same return
type
What type of inheritance does Java have? - correct answer ✔single
inheritance
Can an object be a subclass of another object? - correct answer ✔No—
inheritance is only between classes.