Which method1 will be executed when the following statements are executed?

(code}
ClassA item1 = new ClassB();
item1.method1();

```


```

Given the following code:

Line 1 public class ClassA
Line 2 {
Line 3 public ClassA() {}
Line 4 public void method1(int a){}
Line 5 }
Line 6 public class ClassB extends ClassA
Line 7 {
Line 8 public ClassB(){}
Line 9 public void method1(){}
Line 10 }
Line 11 public class ClassC extends ClassB
Line 12 {
Line 13 public ClassC(){}
Line 14 public void method1(){}
Line 15 }

```

a. method1 on Line 4
b. method1 on Line 9
c. method1 on Line 14
d. This is an error and will cause the program to crash.

b. method1 on Line 9

Computer Science & Information Technology

You might also like to view...

The ________ function counts the cells containing numbers in the column of records that match the conditions you specify

A) DAVERAGE B) AVERAGE C) DCOUNT D) DSUM

Computer Science & Information Technology

A recursive method .

a. is a method that calls itself. b. can be called directly. c. can be called indirectly through another method. d. All of the above.

Computer Science & Information Technology