Meaningless Drivel is fun!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Are arrays objects in Java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Are arrays objects in Java?" Watch "Are arrays objects in Java?" New topic

Are arrays objects in Java?

Lokanadham Nalla

Joined: Jul 21, 2005
Posts: 7

I read in some book as "Arrays are objects in Java" and also "All arrays of reference type are subtypes of the array type Object[], but arrays of primitive data types are not. Note that the array type Object[] is also a subtype of Object type".

How is the first statement "Arrays are onjects in Java" true for primitive type arrays? Are primitive type arrays not objects?

Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
The arrays are objects in JAVA including primitive type arrays, See JLS
Marcus Green
arch rival

Joined: Sep 14, 1999
Posts: 2813
All arrays (the thing that contains the elements) are Objects. The elements of an array (what an array contains), may be either an Object or a primitive.

SCWCD: Online Course, 50,000+ words and 200+ questions
I agree. Here's the link:
subject: Are arrays objects in Java?
It's not a secret anymore!