How to get the address of an index of array in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to get the address of an index of array in java?

10th Aug 2019, 6:43 AM
Indu Devarashetty
Indu Devarashetty - avatar
2 Answers
+ 7
Indu Devarashetty You can't get the memory address of any variable in Java because the language doesn't have any direct access to memory. My understanding is the JVM doesn't make that information available at the Java language level.
10th Aug 2019, 8:05 AM
David Carroll
David Carroll - avatar
+ 4
I'm that not familiar with java, but I'm pretty sure you can't do anything with adresses. But in C, arrays reserve a block of adresses, and each index are one ahead the other, so *p[2] equals *(p + 2). That might help.
10th Aug 2019, 7:36 AM
Airree
Airree - avatar