Page 589 - AP Computer Science A, 7th edition
P. 589

{ /∗ implementation not shown ∗/ }
//Private instance variables and other methods are
not shown. }
public class Class3 extends Class2 {
public void method2(Class3 other) { /∗ implementation not shown ∗/ }
//Private instance variables and other methods are
not shown. }
8. Assuming that both Class2 and Class3 have default constructors, which is (are) valid in a client class?
I Class1 c1 = new Class2();
II Class2 c2 = new Class3();
III Class1 c3 = new Class3();
(A) I only
(B) II only
(C) III only
(D) I and II only (E) I, II, and III
9. Consider the following declarations in a client class. Class3 ob3 = new Class3();
Class2 ob2 = new Class2();
Which method calls would be legal?
I II
III
ob3.method1(); ob2.method2(ob3); ob3.method2(ob2);














































































   587   588   589   590   591