4
What is the output of the following program?
class A { int x = 1; }
class B extends A { int x = 2; }
class Main {
public static void main(String[] args) {
A obj = new B();
System.out.println(obj.x + " " + ((B) obj).x);
}
}Hard