wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes one more certpal question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "one more certpal question" Watch "one more certpal question" New topic
Author

one more certpal question

Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
Object [] object=new String[5][5]

i thought this shouldnt compile.....a one dimensional array cannot refer to a 2 dimensional array.......isnt this true?
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
Because array itself is an Object


Sage of The Monstrous Toad of Mount Myoboku
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
so what? rohan i couldnt get you
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
Array is an object.
so we can write like this,

Object o = new String[5];

therefore

Object[] 0 = new String[5][5];

Understood??
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
hmmmmmmmm right
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

The array hierarchy goes like this


[Too late ]


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
Also Object can refrence to an Array, so one dimensional Object array can refrence to two Dimensional array
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: one more certpal question
 
Similar Threads
Need help on two-dimensional array
Sorting two dimensional array
Object reference array assignment
Array Creation
Array