+ 2
Pointers
Why we doesn't have pointers in java?
2 Réponses
+ 1
in languages like c++ we use pointers mainly for memory manipulation, in java we have garbage collection to do that effectively so we dont need pointers in java.
+ 1
not exactly, pointers directly manipulate memory therefore are dangerous and lead to memory leaks, segmentation errors (C) trying to reference memory locations that are invalid or beyond your memory stack. Java implicitly use pointers behind the scenes since Java was written in C but from a design perspective, Java was designed to avoid the explicit use of pointers to prevent from some of the very serious pitfalls that comes with having the power to directly manipulate memory.