-
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.
-
What is the Dictionary class
The Dictionary class provides the capability to store key-value pairs.
-
How are the elements of a BorderLayout organized
The elements of a BorderLayout are organized at the borders (North, South, East, andWest) and the centerof a container.
-
What is the % operator
It is referred to as the modulo or remainder operator. It returns the remainder of dividingthe first operandby the second operand.
-
When can an object reference be cast to an interface reference
An object reference be cast to an interface reference when the object implements thereferenced interface.
-
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 aFont object.
-
How is rounding performed under integer division
The fractional part of the result is truncated. This is known as rounding toward zero.
-
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 acquirean object's lock, it enters the waiting state until the lock becomes available.
-
What classes of exceptions may be caught by a catch clause
A catch clause can catch any exception that may be assigned to the Throwable type. Thisincludes the Errorand Exception types.
-
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 orcontinue statement.
Java Interview Questions
Ans