Pointers | Sololearn: Learn to code for FREE!

+2

Pointers

Why we doesn't have pointers in java?

7/16/2016 5:24:22 AM

Chander Mohan Pundhir

2 Answers

New Answer

+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.