class Parent {
int i = 60;
}
class Child extends Parent {
int i = 70;
}
class Main {
public static void main(String[] args) {
Child c = new Child();
Parent p = new Parent();
System.out.println((Parent c).i);
}
}
Here I want to print a Parent class variable (i.e. i = 60) with the help of a Child class object. How can I do that?