If I have two objects not related to each other. What will happen in the following cases: We have: Object A, Object B
A a = new A();
B b = new B();
- a = b; \will compile? will I get an exception?
- a = (A) b; \will compile ? afterwards - will I get an exception?
You can simply compile them to get the answer as well.
No Won't compile
No Won't compile
See Also