-
When a thread is created and started, what is its initial state
A thread is in the ready state after it has been created and started.
-
Can an anonymous class be declared as implementing an interface andextending a class
An anonymous class may implement an interface or extend a superclass, but may not bedeclared to doboth.
-
What is the range of the short type
The range of the short type is -(2^15) to 2^15 - 1.
-
-
What is the purpose of finalization
The purpose of finalization is to give an unreachable object the opportunity to performany cleanupprocessing before the object is garbage collected.
-
-
What invokes a thread's run() method
After a thread is started, via its start() method or that of the Thread class, the JVMinvokes the thread'srun() method when the thread is initially executed.
-
Name three subclasses of the Component class
Box.Filler, Button, Canvas, Checkbox, Choice, Container, Label, List, Scrollbar, orTextComponent
-
What is the GregorianCalendar class
The GregorianCalendar provides support for traditional Western calendars.
-
-
What is the purpose of the Runtime class
The purpose of the Runtime class is to provide access to the Java runtime system.
-
How many times may an object's finalize() method be invoked by the garbagecollector
An object's finalize() method may only be invoked once by the garbage collector.
-
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 ornot an exception isthrown or caught.
-
What is the argument type of a program's main() method
A program's main() method takes an argument of the String[] type.
-
Which Java operator is right associative
The = operator is right associative.
-
Can a double value be cast to a byte
Yes, a double value can be cast to a byte.
-
What must a class do to implement an interface
It must provide all of the methods in the interface and identify the interface in itsimplements clause.
-
What method is invoked to cause an object to begin executing as a separatethread
The start() method of the Thread class is invoked to cause an object to begin executing asa separate thread.
-
Name two subclasses of the TextComponent class
TextField and TextArea
-
Java Interview Questions
Ans