Advanced Java Questions and Answer for Interview
51. Name three subclasses of the Component class.
Box.Filler, Button, Canvas, Checkbox, Choice, Container, Label, List, Scrollbar, or
52. What is the GregorianCalendar class?
GregorianCalendar class provides support for traditional Western calendars.
53. Which Container method is used to cause a container to be laid out and redisplayed?
validate() method is used to cause a container to be laid out and redisplayed.
54. What is the purpose of the Runtime class?
The purpose of the
Runtime class is to provide access to the Java runtime system.
55. How many times may an object's finalize() method be invoked by the garbage collector?
finalize() method may only be invoked once by the garbage collector.
56. 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.
57. What is the argument type of a program's main() method?
main() method takes an argument of the
58. Which Java operator is right associative?
= operator is right associative.
59. Can a double value be cast to a byte?
double value can be cast to a
60. 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.