- 
                    When can an object reference be cast to an interface referenceAn object reference be cast to an interface reference when the object implements thereferenced interface. 
- 
                    What is the difference between a static and a non-static inner classA non-static inner class may have object instances that are associated with instances ofthe class's outerclass. A static inner class does not have any object instances. 
- 
                    How are commas used in the initialization and iteration parts of a for statementCommas are used to separate multiple statements within the initialization and iterationparts of a forstatement. 
- 
                    What class allows you to read objects directly from a stream?The ObjectInputStream class supports the reading of objects from input streams. 
- 
                    What methods are used to get and set the text label displayed by a ButtonobjectgetLabel() and setLabel() 
- 
                    What is the difference between the Font and FontMetrics classesThe FontMetrics class is used to define implementation-specific properties, such asascent and descent, of aFont object. 
- 
                    What is the purpose of the finally clause of a try-catch-finally statementThe finally clause is used to provide the capability to execute code no matter whether ornot an exception isthrown or caught. 
- 
                    What is the purpose of finalizationThe purpose of finalization is to give an unreachable object the opportunity to performany cleanupprocessing before the object is garbage collected. 
- 
                    What classes of exceptions may be thrown by a throw statementA throw statement may throw any expression that may be assigned to the Throwabletype. 
- 
                    What must a class do to implement an interfaceIt must provide all of the methods in the interface and identify the interface in itsimplements clause. 
- 
                    What are the legal operands of the instanceof operatorThe left operand is an object reference or null value and the right operand is a class,interface, or array type. 
- 
                    What modifiers can be used with a local inner classA local inner class may be final or abstract. 
- 
                    What modifiers may be used with an interface declarationAn interface may be declared as public or abstract. 
- 
                    For which statements does it make sense to use a labelThe only statements for which it makes sense to use a label are those statements that canenclose a break orcontinue statement. 
- 
                    How are the elements of a CardLayout organizedThe elements of a CardLayout are stacked, one on top of the other, like a deck of cards. 
- 
                    What classes of exceptions may be caught by a catch clauseA catch clause can catch any exception that may be assigned to the Throwable type. Thisincludes the Errorand Exception types. 
- 
                    What class of exceptions are generated by the Java run-time systemThe Java runtime system generates RuntimeException and Error exceptions. 
- 
                    
- 
                    How are this and super usedThis is used to refer to the current object instance. super is used to refer to the variablesand methods of the superclass of the current object instance. 
- 
                    What happens if an exception is not caughtAn uncaught exception results in the uncaughtException() method of the thread'sThreadGroup being invoked, which eventually results in the termination of the programin which it is thrown. 
Java Interview Questions

 
  
  
  
		
Ans