Multiple Choice
For the questions below, 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;
}
}
-Which of the following is True regarding Java classes?
A) All classes must have 1 parent but may have any number of children (derived or extended) classes
B) All classes must have 1 child (derived or extended) class but may have any number of parent classes
C) All classes must have 1 parent class and may have a single child (derived or extended) class
D) All classes can have any number (0 or more) of parent classes and any number of children (derived or extended) classes
E) All classes can have either 0 or 1 parent class and any number of children (derived or extended) classes
Correct Answer:

Verified
Correct Answer:
Verified
Q10: Why is it a contradiction for an
Q13: If classes C1 and C2 both implement
Q17: For the questions below, consider the following
Q18: If a programmer writes a class wanting
Q19: For the questions below, assume that Poodle
Q20: A variable declared to be of one
Q23: Write the init and paint methods of
Q24: For the questions below, assume that Student,
Q25: For the questions below, use the following
Q27: For the next questions, consider the following