-
What is an Iterator interface
The Iterator interface is used to step through the elements of a Collection.
-
What is the difference between the >> and >>> operators
The >> operator carries the sign bit when shifting right. The >>> zero-fills bits that havebeen shifted out.
-
-
What is the difference between yielding and sleeping
When a task invokes its yield() method, it returns to the ready state. When a task invokesits sleep()method, it returns to the waiting state.
-
Is sizeof a keyword
The sizeof operator is not a keyword.
-
What are wrapped classes
Wrapped classes are classes that allow primitive types to be accessed as objects.
-
Does garbage collection guarantee that a program will not run out of memory
Garbage collection does not guarantee that a program will not run out of memory. It ispossible forprograms to use up memory resources faster than they are garbage collected. It is alsopossible forprograms to create objects that are not subject to garbage collection
-
What restrictions are placed on the location of a package statement within asource code file
A package statement must appear as the first line in a source code file (excluding blanklines andcomments).
-
Can an object's finalize() method be invoked while it is reachable
An object's finalize() method cannot be invoked by the garbage collector while the objectis still reachable.However, an object's finalize() method may be invoked by other objects.
-
-
Name three Component subclasses that support painting
The Canvas, Frame, Panel, and Applet classes support painting.
-
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 is clipping
Clipping is the process of confining paint operations to a limited area or shape.
-
What is a native method
A native method is a method that is implemented in a language other than Java.
-
Can a for statement loop indefinitely
Yes, a for statement can loop indefinitely. For example, consider the following:for(;;) ;
-
When a thread blocks on I/O, what state does it enter
A thread enters the waiting state when it blocks on I/O.
-
To what value is a variable of the String type automatically initialized
The default value of an String type is null.
-
What is the catch or declare rule for method declarations
If a checked exception may be thrown within the body of a method, the method musteither catch theexception or declare it in its throws clause.
-
What class is the top of the AWT event hierarchy
The java.awt.AWTEvent class is the highest-level class in the AWT event-classhierarchy.
Java Interview Questions
Ans