All Java pointers (references) are smart pointers.
Java runs in a managed environment. This means that Java uses the garbage collector to clean up variables that are no longer referenced.
Java references are slightly different from pointers. Java abstracts all pointer values ββand math that you see in C ++. Thus, at any time when you create a new object and store it in a variable, you store it in the Java version of the smart pointer.
jjnguy
source share