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 addEm to now add all three values, return the sum, and changeEm to change x and y, but leave z alone. Which should you do?
A) Redefine addEm and changeEm without referencing super.addEm() or super.changeEm() .
B) Redefine addEm to return the value of z+super.addEm() , but leave changeEm alone.
C) Redefine changeEm to call super.changeEm() and then set z = x + y, but leave addEm alone.
D) Redefine addEm to return the value of z+super.addEm() and redefine changeEm to call super.changeEm() and then set z = x + y.
E) Redefine changeEm to call super.changeEm() without doing anything to z, and redefine addEm to return super.addEm() .
Correct Answer:

Verified
Correct Answer:
Verified
Q39: Consider a class Plane and three subclasses,
Q40: Two children of the same parent class
Q41: Inheritance through an extended (derived) class supports
Q42: Example Code Ch 09-5<br>Consider the following class
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
Q47: Interface classes cannot be extended but classes
Q48: Which of the following is correct?<br>A) a
Q49: Example Code Ch 09-4<br>Given the following partial