-
Which class is extended by all other classes
The Object class is extended by all other classes.
-
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.
-
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.
-
What is the purpose of the Runtime class
The purpose of the Runtime class is to provide access to the Java runtime system.
-
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).
-
Why are the methods of the Math class static
So they can be invoked as if they are a mathematical code library.
-
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 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.
-
-
What class of exceptions are generated by the Java run-time system
The Java runtime system generates RuntimeException and Error exceptions.
-
How can the Checkbox class be used to create a radio button
By associating Checkbox objects with a CheckboxGroup.
-
Which non-Unicode letter characters may be used as the first character of anidentifier
The non-Unicode letter characters $ and _ may appear as the first character of anidentifier
-
What class allows you to read objects directly from a stream
The ObjectInputStream class supports the reading of objects from input streams.
-
Name four Container classes
Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane
-
What is the return type of a program's main() method
A program's main() method has a void return type.
-
What restrictions are placed on method overloading
Two methods may not have the same name and argument list but different return types.
-
-
What happens when you add a double value to a String
The result is a String object.
-
What is a void return type
A void return type indicates that a method does not return a value.
-
What is the difference between a Scrollbar and a ScrollPane
A Scrollbar is a Component, but not a Container. A ScrollPane is a Container. AScrollPane handles itsown events and performs its own scrolling.
Java Interview Questions
Ans