-6

For someone coming from C++ background, what is the best way to understand how Java operates without pointers?

5
  • Why do you think the absence of pointers needs to be compensated for? Commented Nov 11, 2016 at 21:00
  • Java has now way to acess memory directly by design and the absence of pointers is considered a feature. You don't have to think about deleting stuff after using it, you can't (normally) create a segfault or forget to terminate a string etc etc... Commented Nov 11, 2016 at 21:22
  • 1
    References are essentially pointers. The only thing java disallows is free manipulation of their value; by restricting the possible operations to dereferencing and assignment. Commented Nov 11, 2016 at 21:27
  • @JamesKPolk in order to access memory. Am I wrong in expecting so? Commented Nov 11, 2016 at 21:29
  • You haven't defined what you mean by "access memory." Java can manipulate objects on its heap as much as you like. Commented Nov 11, 2016 at 22:29

1 Answer 1

2

Java is a garbage collected language. There are pointers, but they are managed for you by a memory manager. See various answers on SO, such as What is the garbage collector in Java?

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.