• Post Reply Bookmark Topic Watch Topic
  • New Topic

doubt in instanceof from sybex  RSS feed

 
Aniket Harode
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,

from the sybex java 8 book there is one question



here the compile error is in l instanceof Chipmunk

so, i am little bit confuse that how we gone find out l is instanceof which and why there has been an error in  these and why the (r instanceof Chipmunk)???
 
s ravi chandran
Ranch Hand
Posts: 579
6
Java jQuery
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
l is an instance of List<T>. Hence compiler straight away points that out.

what you might do is try 

 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aniket Harode wrote:so, i am little bit confuse that how we gone find out l is instanceof which and why there has been an error in  these and why the (r instanceof Chipmunk)?

You can find a detailed explanation in this thread (it's about instanceof operator but as you will see casting & instanceof are related...). This thread might help as well.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!