-
What method is invoked to cause an object to begin executing as a separate thread
The start() method of the Thread class is invoked to cause an object to begin executing asa separate thread.
-
-
How are commas used in the intialization and iteration parts of a for statement
Commas are used to separate multiple statements within the initialization and iterationparts of a for statement.
-
What is an abstract method
An abstract method is a method whose implementation is deferred to a subclass.
-
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.
-
Can a Byte object be cast to a double value
No, an object cannot be cast to a primitive value.
-
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 outer class. A static inner class does not have any object instances.
-
What is the % operator
It is referred to as the modulo or remainder operator. It returns the remainder of dividingthe first operand by the second operand.
-
What is the difference between a Window and a Frame
The Frame class extends Window to define a main application window that can have amenu bar.
-
Which class is extended by all other classes
The Object class is extended by all other classes.
-
Can an object be garbage collected while it is still reachable
A reachable object cannot be garbage collected. Only unreachable objects may begarbage collected..
-
What is the difference between the Font and FontMetrics classes
The FontMetrics class is used to define implementation-specific properties, such asascent and descent, of a Font object.
-
What happens when a thread cannot acquire a lock on an object
If a thread attempts to execute a synchronized method or synchronized statement and isunable to acquire an object's lock, it enters the waiting state until the lock becomesavailable.
-
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.
-
If a class is declared without any access modifiers, where may the class be accessed
A class that is declared without any access modifiers is said to have package access. Thismeans that the class can only be accessed by other classes and interfaces that are definedwithin the same package.
-
What is the SimpleTimeZone class
The SimpleTimeZone class provides support for a Gregorian calendar.
-
What is the Map interface
The Map interface replaces the JDK 1.1 Dictionary class and is used associate keys withvalues.
-
For which statements does it make sense to use a label
The only statements for which it makes sense to use a label are those statements that canenclose a break or continue statement.
-
What is the purpose of the System class
The purpose of the System class is to provide access to system resources.
Java Interview Questions
Ans