-
Name four Container classes
Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane
-
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.
-
What is the difference between a field variable and a local variable
A field variable is a variable that is declared as a member of a class. A local variable is avariable that isdeclared local to a method.
-
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 becomeunreachable.
-
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 is the relationship between a method's throws clause and the exceptionsthat can bethrown during the method's execution
A method's throws clause must declare any checked exceptions that are not caught withinthe body of themethod.
-
Why are the methods of the Math class static
So they can be invoked as if they are a mathematical code library.
-
-
What state is a thread in when it is executing
An executing thread is in the running state.
-
What are the legal operands of the instanceof operator
The left operand is an object reference or null value and the right operand is a class,interface, or array type.
-
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 someway 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 notallow 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.
-
Are true and false keywords
The values true and false are not keywords.
-
What is a void return type
A void return type indicates that a method does not return a value.
-
What happens when you add a double value to a String
The result is a String object.
Java Interview Questions
Ans