Results 1 to 3 of 3
Thread: Arrays memory addresses
- 03-04-2011, 05:56 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 61
- Rep Power
- 0
Arrays memory addresses
package basics;
public class Mgr
{}
public static void main(String[] args)
{
int all[] = new int [10];}
System.out.println(all);
System.out.println(all[1]);
output
[I@1242719c
0
Hi
i want to know the memory addresses of each element in the array
here i am printing System.out.println(all);
if all is starting element`s memory address of the array all[].?
then how to know the remaining elements memory addresses which are in the array all[]
more ever the address [I@1242719c its keep on changing when ever i compile for the next time to [I@1242719c1,,,,i want to know the reason why it happens so
Thanks in advance
DayaLast edited by Dayanand; 03-04-2011 at 06:13 AM.
- 03-04-2011, 07:52 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,394
- Blog Entries
- 7
- Rep Power
- 17
Java is not C (nor C++) and you can't have a 'memory address' from an object by just using Java but more important: why do you want such functionality? It isn't needed in Java.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-04-2011, 09:17 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,448
- Rep Power
- 16
Similar Threads
-
Printing memory addresses and null values
By Ben1 in forum New To JavaReplies: 21Last Post: 10-11-2010, 05:05 PM -
How Multi-Dimensional arrays are represented in memory
By Riaz Ali in forum New To JavaReplies: 4Last Post: 08-01-2010, 09:25 AM -
not displaying all ip addresses connected to the network
By a_maged in forum NetworkingReplies: 0Last Post: 04-15-2009, 02:49 AM -
should i use arrays or hashtables for less memory usage?
By arnab321 in forum New To JavaReplies: 2Last Post: 12-07-2008, 06:13 PM -
how to read memory addresses
By fred in forum New To JavaReplies: 1Last Post: 07-24-2007, 01:59 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks