-
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.
-
Which package is always imported by default
The java.lang package is always imported by default.
-
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.
-
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 thesuperclass of the current object instance.
-
What is the purpose of garbage collection
The purpose of garbage collection is to identify and discard objects that are no longerneeded by a programso that their resources may be reclaimed and reused.
-
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.
-
How can a dead thread be restarted
A dead thread cannot be restarted.
-
What happens if an exception is not caught
An uncaught exception results in the uncaughtException() method of the thread'sThreadGroup beinginvoked, which eventually results in the termination of the program in which it is thrown.
-
What is a layout manager
A layout manager is an object that is used to organize components in a container.
-
Which arithmetic operations can result in the throwing of anArithmeticException
Integer / and % can result in the throwing of an ArithmeticException.
-
What are three ways in which a thread can enter the waiting state
A thread can enter the waiting state by invoking its sleep() method, by blocking on I/O,by unsuccessfullyattempting to acquire an object's lock, or by invoking an object's wait() method. It canalso enter thewaiting state by invoking its (deprecated) suspend() method.
-
Can an abstract class be final
An abstract class may not be declared as final.
-
What is the ResourceBundle class
The ResourceBundle class is used to store locale-specific resources that can be loaded bya program totailor the program's appearance to the particular locale in which it is being run.
-
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.
-
What is the difference between a public and a non-public class
A public class may be accessed outside of its package. A non-public class may not beaccessed outside ofits package.
Java Interview Questions
Ans