class A {
public int a = 100;
}
class B extends A {
public int a = 80;
}
class C extends B {
public int a = 10;
public void show() {
int a = 0;
System.out.println(a);
System.out.println(super.a);
System.out.println(((A) this).a);
}
}
What does ((A) this).a
in the line System.out.println(((A) this).a);
do?
Is it upcasting/downcasting this
or is something else happening here?
I also tried System.out.println(this);
and System.out.println((A)this);
and they both have the same output. What exactly is happening here?