Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

arrays heirarchi

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry that I am asking this question 3rd time .
sombody has mentioned this in previous post :
reference variable's array extends from Object[] & it extends from Object .
Object
^
Object[]
^
String[]

------------------------------
String s[] = new String[2];

In my opinion , s is extending from Object class itself , not from Object[] ...

please solve my doubt ...
Thanks .
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String[] s extends Object[] extends Object
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why it is like this ?
thanks .
 
Jay Pawar
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rathi,
You can perform simple litmus test to verify this


Hope that helps
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In my opinion , s is extending from Object class itself , not from Object[]

Trying not to using your own opinion on doubtful issues. The best way to verify, as Jay said, is to write the code and test it.

As other said, SCJP Tiger requires lots of coding practices.

Nick
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic