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: Which of the following would best redefine the toString method for BClass?
A) public String toString(int z)
{
Return " " + x + " " + y + " " + z;
}
B) public String toString()
{
Return super.toString() ;
}
C) public String toString()
{
Return super.toString() + " " + z;
}
D) public String toString()
{
Return super.toString() +" " x+" "+y+" "+z;
}
E) public String toString()
{
Return " " + x + " + y + " " + z;
}
Correct Answer:

Verified
Correct Answer:
Verified
Q1: If you instantiate an abstract class, the
Q8: Example Code Ch 09-1<br>Consider the following class
Q9: If a programmer writes a class that
Q10: Why is it a contradiction for an
Q11: Explain the difference between using an imported
Q14: The JavaFX API offers the programmer controls
Q15: You may use the super reserved word
Q16: Assume a class Triangle has been defined.
Q17: A motorcycle inherits properties from both a
Q18: In order to use a dialog box