Type in your answers to each of these questions in a file named
prelab11.txt
in your Prelab Questions
directory. Turn in your answers before the
beginning of your laboratory session.
Question #1: A common superclass for several subclasses is called a ____________ class.
Question #2: The constructor for a superclass can be invoked with the ____________ keyword.
Question #3: If a class is declared
abstract
, what can't you do with the
class?
Question #4: Redefining an inherited method in a subclass is called ____________ the method.
Question #5: Instance variables should have ____________ visibility.
Code #1: Write a declaration for a class named
A
which is an abstract class.
Code #2: Write a declaration for a class named
B
which is a concrete subclass of A
.
Code #3: Write a declaration for a class named
C
which is a concrete subclass of A
.
Code #4: Write a declaration for a class named
D
which is a concrete subclass of C
.
Code #5: Add one method declaration to
one of these classes for a method named
getName()
. Add this method so that it is defined in
all of the classes. It should return the string
"name"
.