Home > Java Programming > Inheritance > Questions and Answers
Q: |
What is the output for the below code ? public class A { int i = 10; public void printValue() { System.out.println("Value-A"); }; } public class B extends A{ int i = 12; public void printValue() { System.out.print("Value-B"); } } public class Test{ public static void main(String argv[]){ A a = new B(); a.printValue(); System.out.println(a.i); } } | ||||||||||
|
Comment on this Question | |
Name: | |
|