Multiple Choice
Example Code Ch 09-5
Consider the following class definition:
public class AClass
{
protected int x;
protected int y;
public AClass(int a, int b)
{
x = a;
y = b;
}
public int addEm()
{
return x + y;
}
public void changeEm()
{
x++;
y--;
}
public String toString()
{
return "" + x + " " + y;
}
}
-Refer to Example Code Ch 09-5: You want to extend AClass to BClass. BClass will have a third int instance data, z. Which of the following would best define BClass's constructor?
A) public BClass(int a, int b, int c)
{
Super(a, b, c) ;
}
B) public BClass(int a, int b, int c)
{
X = a;
Y = b;
Z = c;
}
C) public BClass(int a, int b, int c)
{
Z = c;
}
D) public BClass(int a, int b, int c)
{
Super(a, b) ;
Z = c;
}
E) public BClass(int a, int b, int c)
{
Super() ;
}
Correct Answer:

Verified
Correct Answer:
Verified
Q37: The protected visibility modifier provides the best
Q38: Example Code Ch 09-6<br>Assume that Student, Employee
Q39: Consider a class Plane and three subclasses,
Q40: Two children of the same parent class
Q41: Inheritance through an extended (derived) class supports
Q43: Example Code Ch 09-2<br>Assume that Poodle is
Q44: Example Code Ch 09-3<br>Consider the class Car
Q45: The relationship between a parent class and
Q46: Example Code Ch 09-5<br>Consider the following class
Q47: Interface classes cannot be extended but classes