Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pointers are replaced with what in Java? [duplicate]

Tags:

java

pointers

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

like image 717
Dale Steyn Avatar asked Feb 26 '26 07:02

Dale Steyn


1 Answers

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.

like image 180
Juned Ahsan Avatar answered Mar 02 '26 16:03

Juned Ahsan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!