package Test;
public class ExtendsTwo {
public static void main(String[] args) {
Son s=new Son();
s.print();
}
}
class Father{
int num1=10;
int num2=20;
}
class Son extends Father{
int num2=30;
public void print() {
System.out.println(this.num1);//10 Because the subclass inherits the things of the parent class, it can be called with this, if the subclass has it, the subclass is called , otherwise call
System.out.println(num2) of the parent class;//30 Call the nearest one first, which is actually equivalent to this.num2, but omits this
System.out.println(super.num2);//20
}
}