-
What is the difference between a Choice and a List
A Choice is displayed in a compact form that requires you to pull it down to see the listof available choices. Only one item may be selected from a Choice. A List may bedisplayed in such a way that several List items are visible. A List supports the selectionof one or more List items.
-
What class of exceptions are generated by the Java run-time system
The Java runtime system generates RuntimeException and Error exceptions.
-
What class allows you to read objects directly from a stream
The ObjectInputStream class supports the reading of objects from input streams.
-
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.
-
How are this() and super() used with constructors
This() is used to invoke a constructor of the same class. super() is used to invoke asuperclass constructor.
-
-
What state is a thread in when it is executing
An executing thread is in the running state.
-
How are the elements of a GridLayout organized
The elements of a GridBad layout are of equal size and are laid out using the squares of agrid.
-
What an I/O filter
An I/O filter is an object that reads from one stream and writes to another, usuallyaltering the data in some way as it is passed from one stream to another.
-
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.
-
What is the Set interface
The Set interface provides methods for accessing the elements of a finite mathematicalset. Sets do not allow duplicate elements.
-
What classes of exceptions may be thrown by a throw statement
A throw statement may throw any expression that may be assigned to the Throwabletype.
-
What are E and PI
E is the base of the natural logarithm and PI is mathematical value pi.
-
What is a void return type
A void return type indicates that a method does not return a value.
-
What is the purpose of the enableEvents() method
The enableEvents() method is used to enable an event for a particular object. Normally,an event is enabled when a listener is added to an object for a particular event. TheenableEvents() method is used by objects that handle events by overriding their eventdispatchmethods.
-
What interface must an object implement before it can be written to astream as an object
An object must implement the Serializable or Externalizable interface before it can bewritten to a stream as an object.
-
How are this and super used
This is used to refer to the current object instance. super is used to refer to the variablesand methods of the superclass of the current object instance.
-
What is a compilation unit
A compilation unit is a Java source code file.
-
What interface is extended by AWT event listeners
All AWT event listeners extend the java.util.EventListener interface.
-
What happens if an exception is not caught
An uncaught exception results in the uncaughtException() method of the thread'sThreadGroup being invoked, which eventually results in the termination of the programin which it is thrown.
Java Interview Questions
Ans