aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Object and array ref Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Object and array ref" Watch "Object and array ref" New topic

Object and array ref

Ganesh Pujar
Ranch Hand

Joined: Mar 22, 2006
Posts: 45
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

Joined: Mar 11, 2002
Posts: 1140
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

Quaerendo Invenietis
Ganesh Pujar
Ranch Hand

Joined: Mar 22, 2006
Posts: 45

In the above case, how can we ref x[4] using c! (i think c[4] is not possible )
I agree. Here's the link:
subject: Object and array ref
Similar Threads
Array is instance of an Object? No API in JavaDocs
Doubt in arrays
Widening Reference Conversation
String syntax
How to get current paragraph number