What is the output of the following Java program?
class P { int x = 10; int get() { return x; } }
class C extends P { int x = 20; int get() { return x; } }
public class Main {
public static void main(String[] args) {
P p = new C();
System.out.println(p.x + " " + p.get() + " " + ((C) p).x);
}
}- A20 20 20
- B10 10 20
- C10 20 20
- D10 20 10
Correct answer: C