-
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 are the Object and Class classes used for
The Object class is the highest-level class in the Java class hierarchy. The Class class isused to represent the classes and interfaces that are loaded by a Java program..
-
What is the ResourceBundle class
The ResourceBundle class is used to store locale-specific resources that can be loaded bya program to tailor the program's appearance to the particular locale in which it is beingrun.
-
Dynamic method Dispatch
What is dynamic method dispatch?
-
What is the Set interface
The Set interface provides methods for accessing the elements of a finite mathematicalset. Sets do notallow duplicate elements.
-
Name four methods every Java class will have.
public String toString();public Object clone();public boolean equals();public int hashCode();
-
Q: What is it object serialization ?
Serialization is a way to convert objects (including complex data structures such as lists and trees) into a stream of bytes.
-
-
What interface must an object implement before it can be written to a streamas an object
An object must implement the Serializable or Externalizable interface before it can bewritten to a stream asan object.
-
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.
-
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.
-
-
If a variable is declared as private, where may the variable be accessed
A private variable may only be accessed within the class in which it is declared.
-
What is a compilation unit
A compilation unit is a Java source code file.
-
Which package is always imported by default
The java.lang package is always imported by default.
-
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 event results from the clicking of a button
The ActionEvent event is generated as the result of the clicking of a button.
-
What are E and PI
E is the base of the natural logarithm and PI is mathematical value pi.
-
What is the highest-level event class of the event-delegation model
The java.util.EventObject class is the highest-level class in the event-delegation classhierarchy.
-
Is a class a subclass of itself
A class is a subclass of itself.
Java Interview Questions
Ans