-
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
-
-
How are commas used in the initialization and iteration parts of a for statement
Commas are used to separate multiple statements within the initialization and iterationparts of a forstatement.
-
What is an abstract method
An abstract method is a method whose implementation is deferred to a subclass.
-
What is the relationship between the Canvas class and the Graphics class
A Canvas object provides access to a Graphics object via its paint() method.
-
What are the high-level thread states
The high-level thread states are ready, running, waiting, and dead.
-
What value does read() return when it has reached the end of a file
The read() method returns -1 when it has reached the end of a file.
-
What is the difference between a static and a non-static inner class
A non-static inner class may have object instances that are associated with instances ofthe class's outerclass. A static inner class does not have any object instances.
Java Interview Questions
Ans