Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Array Instanceof operator

 
Sami Devine
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This example is from SCJP6, Kathy Sierra





I understand that both Foo[] and Foo[1] are instances of Object. What is the difference between Foo[] and Foo[1].


[HENRY: Fixed code tags]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Foo[]" is meant to suggest an array of Foo objects. Foo[1] is meant to suggest a single element of that array -- i.e., a Foo object.
 
Sami Devine
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic