-
Why are the methods of the Math class static
So they can be invoked as if they are a mathematical code library.
-
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).
-
What is the purpose of the Runtime class
The purpose of the Runtime class is to provide access to the Java runtime system.
-
What method is invoked to cause an object to begin executing as a separatethread
The start() method of the Thread class is invoked to cause an object to begin executing asa separate thread.
-
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.
-
Which class is extended by all other classes
The Object class is extended by all other classes.
-
Is a class a subclass of itself
A class is a subclass of itself.
-
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.
-
What are E and PI
E is the base of the natural logarithm and PI is mathematical value pi.
-
What event results from the clicking of a button
The ActionEvent event is generated as the result of the clicking of a button.
-
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.
-
Which package is always imported by default
The java.lang package is always imported by default.
-
What is a compilation unit
A compilation unit is a Java source code file.
-
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.
-
-
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.
-
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 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.
-
-
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.
Java Interview Questions
Ans