+ 4
Why we are using pointer in C and C++ but not in java?
5 Answers
+ 5
Because C++ is meant to be a language where you can interact with the hardware with low level features, yet still have higher level features such as classes.
Java on the other hand favors safety. Java uses references, which are safer than pointers and get the job done for Java's purpose.
It should be noted that C++ also supports references. And they should of course be used instead of pointers when pointers aren't needed.
+ 2
got it but the question is why we can not use it in java.
+ 2
I have an article related to this question
https://javax0.wordpress.com/2016/01/06/pointers-in-java/
+ 1
Edit
I believe reference types are the closest thing to pointers in Java
0
actually java also uses pointers but unlike c they use it internally.