• Post Reply Bookmark Topic Watch Topic
  • New Topic

why is this failing?  RSS feed

 
s sivaraman
Ranch Hand
Posts: 59
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,



have i interpreted correctly at the error line?
what went wrong there?

thank you
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you cast a reference, the object itself doesn't change its type. So if you cast using (I)a, that doesn't turn the object referenced by a into an object that is all of a sudden compatible with class B - it's still an instance of class A.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!