• Post Reply Bookmark Topic Watch Topic
  • New Topic

address of primitive data type  RSS feed

 
sivaprasad chintapalli
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I find the address of primitive data type in java.
ie how can I find the adrress of constant 'a' declared below,

final static int a =40;

Quick response would be highly appreciated .
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Quick response would be highly appreciated .


Isnt it always ?
What do you intend to do with the info anyways ?
And besides this is not the right forum, I believe, for such questions.

cheers,
ram.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not a Servlet question so I'll move it to the Java in General (beginner) forum. You'll be sure to get a quick reply there.

Dave
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll bite and supply the quick answer David was talking about

You can't. Java hides the details of in-memory representation, and particularly has no concept of accessing data structures in memory by address. Given that, the previous poster was right to ask: what do you need the info for?
 
Steve Morrow
Ranch Hand
Posts: 657
Clojure Spring VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I find the address of primitive data type in java.
Short answer: You can't. If it's local, it's on the stack. If it's a member of an object, it's on the heap. Either way, there's no way in Java to get at that information; Java doesn't allow it by design.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!