Does Java has pointers? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

Does Java has pointers?

25th Oct 2018, 5:32 PM
Vivek
Vivek - avatar
2 Antworten
+ 1
Paul Thanks for the explanation.
25th Oct 2018, 6:24 PM
Vivek
Vivek - avatar
+ 3
Java does have pointers. Any time you create an object in Java, you're actually creating a pointer to the object; this pointer could then be set to a different object or to null, and the original object will still exist (pending garbage collection). What you can't do in Java is pointer arithmetic. You can't dereference a specific memory address or increment a pointer. If you really want to get low-level, the only way to do it is with the Java Native Interface; and even then, the low-level part has to be done in C or C++.
25th Oct 2018, 6:07 PM
'Paul
'Paul - avatar