Friday, May 2, 2008

Java Interview Questions 19

91: What is the purpose of finalization?
A: The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.

92: What is the Locale class?
A: The Locale class is used to tailor program output to the conventions of a particular geographic, political, or cultural region.

93: What is the difference between a while statement and a do statement?
A: A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once.

94: What is the difference between static and non-static variables?
A: A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.

95: How are this() and super() used with constructors?
A: Othis() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.

No comments:

Useful Information