This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes is Arrays  are Object? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "is Arrays  are Object?" Watch "is Arrays  are Object?" New topic
Author

is Arrays are Object?

Thennam Pandian
Ranch Hand

Joined: Oct 11, 2005
Posts: 163
is Array in java are Object?

int a[]=new int[10];

new will allocate memory. but int is a type not an Class ?

please help me.......
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24081
    
  15

An array of any type is an Object, yes -- an array is an instance of a special synthetic class that extends, directly or indirectly, java.lang.Object, just like any other class. You can call hashCode(), equals(), toString(), and other Object methods on any array.

The fact that an int[] is a class doesn't mean that "int" is a class -- it's not.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: is Arrays are Object?
 
Similar Threads
question related to ragged array
Vector.addElement() not working
Conversion of reference values
References
Simple questions on arrays