I have this simple code from one of the sample tests. I am getting confused in line 14. I would appreicte if any
Java Guru can explain that what is the value of b. Is it of Derived1 object or Base object.
Here is the code.
1: class Base{
2: // legal code
3:}
4: class Derived1 extends Base{
5: // legal code
6:}
7: class Derived2 extends Base{
8: // legal code
9:}
10

ublic class
Test 11:{
12: static public void main(
String [] args)
13: {
14: Base b = new Derived1 ();
15: Derived1 d1 = new Derived1();
16: Derived2 d2 = new Derived2();
17: b = (Base) d1;
18: d1 = (Derived1) b;
19: }
20:}