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

Object and array ref

 
Ganesh Pujar
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

How is the following statement leagal?



As the C is a ref to Object (Not an array!, and anonymous array is agned to c)
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is valid because, in Java, an array is an object. You can even invoke the methods defined in the Object class, on an array
 
Ganesh Pujar
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



In the above case, how can we ref x[4] using c! (i think c[4] is not possible )
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic