9.4.3 Q1: Consider the classes below, declared in the same file:
class A
{
int a;
public A()
{
a = 7;
}
}
class B extends A
{
int b;
public B()
{
b = 8;
}
}
Which of the statements below is false?
a. Both variables a and b are instance variables.
b. After the constructor for class B executes, the variable a will have the value 7.
c. After the constructor for class B executes, the variable b will have the value 8.
d. A reference of type A can be treated as a reference of type B.
9.4.3 Q2: Which of the following is the superclass constructor call syntax?
a. keyword super, followed by a dot (.) .
b. keyword super, followed by a set of parentheses containing the superclass constructor arguments.
c. keyword super, followed by a dot and the superclass constructor name.
d. None of the above.
9.4.4 Q1: Which superclass members are inherited by all subclasses of that superclass?
a. private instance variables and methods.
b. protected instance variables and methods.
c. private constructors.
d. protected constructors.
9.4.4 Q2: Which statement is true when a superclass has protected instance variables?
a. A subclass object can assign an invalid value to the superclass’s instance variables, thus leaving an
object in an inconsistent state.
b. Subclass methods are more likely to be written so that they depend on the superclass’s data
implementation.