Question 2


What will happen if you compile/run the following code? 1: class Test 2: { 3: static void show() 4: { 5: System.out.println("Show method in Test class"); 6: } 7: } 8: 9: public class Q2 extends Test 10: { 11: static void show() 12: { 13: System.out.println("Show method in Q2 class"); 14: } 15: public static void main(String[] args) 16: { 17: Test t = new Test(); 18: t.show(); 19: Q2 q = new Q2(); 20: q.show(); 21: 22: t = q; 23: t.show(); 24: 25: q = t; 26: q.show(); 27: } 28: } A) prints "Show method in Test class" "Show method in Q2 class" "Show method in Q2 class" "Show method in Q2 class" B) prints "Show method in Test class" "Show method in Q2 class" "Show method in Test class" "Show method in Test class" C) prints "Show method in Test class" "Show method in Q2 class" "Show method in Test class" "Show method in Q2 class" D) Compilation error.