Page 52 - AP Computer Science A, 7th edition
P. 52
public class ClassTwo extends ClassOne {
public void methodTwo() {
...
}
//Other methods are not shown. }
Consider the following declarations in a client class. You may as s um e t hat ClassOne and ClassTwo hav e def ault constructors.
ClassOne c1 = new ClassOne(); ClassOne c2 = new ClassTwo();
Which of the following method calls will cause an error? I c1.methodTwo();
II c2.methodTwo(); III c2.methodOne(); (A) None
(B) Ionly
(C) IIonly
(D) IIIonly
(E) IandIIonly
23. Consider the code segment
if (n == 1) k++;
else if (n == 4) k += 4;
Suppose that the given segment is rewritten in the form
if (/∗ condition ∗ /)