Advanced Java - Interview Questions V

Q. How many times may an object's finalize() method be invoked by the garbage collector?
An object's finalize() method may only be invoked once by the garbage collector.

Q. What is the purpose of the finally clause of a try-catch-finally statement?
The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown or caught.

Q. What is the argument type of a program's main() method?
A program's main() method takes an argument of the String[] type.

Q. Which Java operator is right associative?
The = operator is right associative.

Q. Can a double value be cast to a byte?
Yes, a double value can be cast to a byte.

Q. What must a class do to implement an interface?
It must provide all of the methods in the interface and identify the interface in its implements clause.

Comments