-
Can an abstract class be final
An abstract class may not be declared as final.
-
What method must be implemented by all threads
All tasks must implement the run() method, whether they are a subclass of Thread orimplement the Runnable interface.
-
What value does readLine() return when it has reached the end of a file
The readLine() method returns null when it has reached the end of a file.
-
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 the Reader/Writer class hierarchy and theInputStream/OutputStream class hierarchy
The Reader/Writer class hierarchy is character-oriented, and theInputStream/OutputStream class hierarchy is byte-oriented.
-
What event results from the clicking of a button
The ActionEvent event is generated as the result of the clicking of a button.
-
-
What is a void return type
A void return type indicates that a method does not return a value.
-
If an object is garbage collected, can it become reachable again
Once an object is garbage collected, it ceases to exist. It can no longer become reachableagain.
-
Under what conditions is an object's finalize() method invoked by the garbagecollector
The garbage collector invokes an object's finalize() method when it detects that the objecthas become unreachable.
-
What's new with the stop(), suspend() and resume() methods in JDK 1.2
The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.
-
How does Java handle integer overflows and underflows
It uses those low order bytes of the result that can fit into the size of the type allowed bythe operation.
-
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.
-
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.
-
Can a double value be cast to a byte
Yes, a double value can be cast to a byte.
-
What is the argument type of a program's main() method
A program's main() method takes an argument of the String[] type.
-
What modifiers may be used with an inner class that is a member of an outerclass
A (non-local) inner class may be declared as public, protected, private, static, final, orabstract.
-
-
Java Interview Questions
Ans