How to output the memory address of a variable in Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to output the memory address of a variable in Java?

13th Aug 2019, 12:29 PM
Preet
2 Answers
0
partially you can get "hashcode" for objects Integer n = 100, m = 200, x=m; System.out.println( System.identityHashCode(n) ); System.out.println( System.identityHashCode(m) ); System.out.println( System.identityHashCode(x) ); there is a similar object.hashCode() but can be overwritten.
13th Aug 2019, 1:16 PM
zemiak
0
nice!
13th Aug 2019, 7:39 PM
Juan Debenedetti
Juan Debenedetti - avatar