Pointers are replaced with what in Java?

java, pointers

Solution

There are no pointers in java. Java works with references.

There is no concept of dynamic memory allocation in java. And hence there is no alternative of `malloc/calloc` in java. The JVM takes care of creating and releasing the memory for objects. As JVM has built in functionality of garbage collection hence no alternative to `free` is also provided.

Problem

I read that pointers are not available in Java. But "This" pointer in C++ is replaced by "This" Keyword. So can someone explain about dynamic memory allocation and replacement for pointers in java

Original source

Related problems