Home > Java Programming > Inheritance > Questions and Answers
Q: |
public class A { public void test1(){ System.out.println("test1"); } } public class B extends A{ public void test2(){ System.out.println("test2"); } } 1. public class Test{ 2. public static void main (String[] args){ 3. A a = new A(); 4. A b = new B(); 5. B b1 = new B(); 6. // insert code here 7. } 8. } Which of the following , inserted at line 6, will compile and print test2? | ||||||||||
|
Comment on this Question | |
Name: | |
|