Java Keywords
Tests knowledge of Java reserved words and their specific usage in programming
Questions
Which Java keyword should be used with a data member to make it non-serializable?
- private
- public
- transient
- unserialize
- none of the above
Which of the following keywords is used to implement inheritance in Java?
- inheritance
- inherit
- extend
- extends
Which of the following statements is correct?
A. super keyword is used to access the constructor of superclass from subclass constructor.
B. super keyword is used to access the variable of superclass from the subclass.
- Only A
- Only B
- Both A and B
- Neither A nor B
Interface can be implemented using the ___________ keyword.
- implement
- implements
- extend
- extends
Which of the following keywords should be used to make a class level variable?
- final
- static
- private
- classlevel
- public
All the variables must be __________ and initialized in the interface.
- static
- finalize
- final
- protected
Which of the following is not a keyword of Java?
- static
- final
- protected
- virtual
The protected access specifier works as ________ for outside world, but works as ________ for derived classes in Java.
- private and public
- public and private
- private and private
- public and public
If the first statement of a constructor has the form ________, then the constructor calls another constructor of the same class.
- static
- this(parameter list)
- this
- static(parameter list)
The protected access specifier is very useful in ___________ inheritance.
- simple
- multiple
- multilevel
- hierarchical
Which of the following statements regarding 'finally' block in Java is false?
- Before the termination of the program, JVM executes the 'finally' block (if any).
- The 'finally' block can be used for writing the cleanup code.
- The 'finally' block must be followed by try or catch block.
- There can be multiple 'finally' blocks for a try block.
- The 'finally' block is not executed if the program exists.