Java Exercises on Keywords
For each question 1 - 12 below, check the most appropriate Java keyword response.
1. Used in a class definition in order to define a subclass of a class.
abstract
extends
protected
super
2. Used to invoke an object's superclass constructor.
abstract
extends
protected
super
3. A class that cannot be directly instantiated and is intended to be subclassed.
abstract
extends
protected
super
4. A kind of method that lacks a body.
abstract
extends
protected
super
5. An intermediate level of access between public and private.
abstract
extends
protected
super
6. A keyword that refers to whatever object uses it.
interface
new
null
this
7. A class that contains only instance methods and constants, but no instance variables.
interface
new
null
this
8. Keyword used to instantiate a reference variable--that is, to create an object that the variable will refer to.
interface
new
null
this
9. Java assigns this keyword to a reference variable that does not yet refer to any object.
interface
new
null
this
10. This kind of block includes a statement that might throw an exception.
catch
final
finally
try
11. This kind of block will handle any exception that matches its parameter class.
catch
final
finally
try
12. Qualifier used to declare a named constant (also called a constant variable) that must be given an initial value which cannot be changed by the program.
catch
final
finally
try
Last Modified: April 20, 2000