This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Objects created on Heap 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 "Objects created on Heap" Watch "Objects created on Heap" New topic
Author

Objects created on Heap

ramya ray
Ranch Hand

Joined: Aug 11, 2006
Posts: 101
Please explain how many objects are created on heap in a multi dimension array.
for eg:

int [][]a = new int[3][]; //how many objects will be created on heap?
and for
int [][]a = new int[3][5]; //how many objects will be created on heap?

Please explain.
Thanks.
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518


1 (A single array is created. That array is an object stored on the heap. The array has three null references.)



4 (An array with references to three other arrays. Each array is an object on the heap.)
ramya ray
Ranch Hand

Joined: Aug 11, 2006
Posts: 101
Thanks a lot for replying ,I got it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Objects created on Heap
 
Similar Threads
garbage collection
How many objects created?
How many objects?
How many objects will be created in Heap when we have multiple instances of a specific object?
problems in number of objects created