Real vs Apparent classes in Java
<pre><code>class A { public static void main(String[] args) 
{ A a = new A(); 
  B b = new B(); 
  A ab = new B(); 
  System.out.format("%d %d %d %d %d %d", a.x, b.x, ab.x, a.y, b.y, ab.y); } 
  int x = 2; 
  int y = 3;
  A(int x) { this.x = x; } 
  A() { this(7); } } 

class B extends A { 
  int y = 4;
  B() { super(6); 
  }
</code></pre>

<p>Hey all, I was just looking through some examples from my course and came across this problem that stumped me.<br>
I realize that 
that this code should print out 
"7 6 6 3 4 3"</p>

<p>But why is ab.y equal to 3? Isn't the "real" type of object ab of class B?
Which then would lead me to believe that ab.y be 4?</p>
