aspose file tools*
The moose likes Java in General and the fly likes array  doubt 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 » Java » Java in General
Bookmark "array  doubt" Watch "array  doubt" New topic
Author

array doubt

Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 1050

class Demo
{

public static void main(String args[])
int a[]=new int[2];
}


not how many object is being created for an array int a is it 2 objects?? or 1 object??


http://www.lifesbizzare.blogspot.com || OCJP:81%
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

Vishal,
array is just a container and here it the case of array of integers. And no objects whatsoever involved in this.
Please check few tutorials.
Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 1050

thankssssssssssss so muchhhhhhh
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36599
    
  16
Balu Sadhasivam wrote:Vishal,
array is just a container and here it the case of array of integers. And no objects whatsoever involved in this.
Please check few tutorials.
I think you are mistaken there.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19557
    
  16

I agree. Arrays are objects themselves as well.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Technically, they're objects. From the rest of Java-style OOP, though... meh. java.util.Arrays and java.lang.System's arraycopy (yay, consistency) shouldn't be necessary, and I've never really understood it--why did they do it like that?
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


yep right .. thanks for the correction..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: array doubt
 
Similar Threads
doubt in arrays...
Issue on arrays
Widening Reference Conversation
array object assignment ??
Why cant we declare the size of Array in java?