+ 2

Pointers

Why we doesn't have pointers in java?

16th Jul 2016, 5:24 AM
Chander Mohan Pundhir
Chander Mohan Pundhir - avatar
2 Respostas
+ 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.
19th Jul 2016, 5:34 PM
sreeraj g
sreeraj g - avatar
+ 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.
22nd Jul 2016, 4:31 AM
Eric Gitangu
Eric Gitangu - avatar