RSS Forums RSS
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 748 | Replies: 4 | Thread Tools  Display Modes
Reply
Join Date: Aug 2008
Posts: 5
Reputation: crbsathy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
crbsathy crbsathy is offline Offline
Newbie Poster

Accessing Memory address

  #1  
Aug 19th, 2008
Hi Friends,
I have a doubt in accessing the memory address .

In java there is no pointers like c . then how can we access the address of the memory variable.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2008
Location: new york
Posts: 343
Reputation: sciwizeh is on a distinguished road 
Rep Power: 1
Solved Threads: 17
sciwizeh's Avatar
sciwizeh sciwizeh is offline Offline
Posting Whiz

Re: Accessing Memory address

  #2  
Aug 19th, 2008
why do you want to?
My site, random PM's from people I haven't hear from before will be DELETED
"If people are good only because they fear punishment, and hope for reward, then we are a sorry lot indeed.",
"If we knew what it was we were doing, it would not be called research, would it? "
-Albert Einstein
Reply With Quote  
Join Date: Aug 2008
Posts: 5
Reputation: crbsathy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
crbsathy crbsathy is offline Offline
Newbie Poster

Re: Accessing Memory address

  #3  
Aug 19th, 2008
Thanks sciwizeh for ur reply.

I need to fetch the memory address of the variable . In one article which i have read that "we cant say that we cant access the memory location".
Reply With Quote  
Join Date: Jun 2008
Location: WA, USA
Posts: 940
Reputation: Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough 
Rep Power: 5
Solved Threads: 100
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Posting Shark

Re: Accessing Memory address

  #4  
Aug 19th, 2008
Originally Posted by crbsathy View Post
Thanks sciwizeh for ur reply.

I need to fetch the memory address of the variable . In one article which i have read that "we cant say that we cant access the memory location".


Use the Object.toString() method to return the memory address.

  1.  
  2. public static void main(String... args){
  3.  
  4. Object o = new Object();
  5. System.out.println(o.toString());
  6.  
  7. }
  8.  
Reply With Quote  
Join Date: Jun 2008
Location: WA, USA
Posts: 940
Reputation: Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough 
Rep Power: 5
Solved Threads: 100
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Posting Shark

Re: Accessing Memory address

  #5  
Aug 19th, 2008
Note that it is a String representation of the memory address and not an accessible (or directly modifiable) memory address.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 7:59 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC