pointer program in java code example
Example 1: pointers in java
Java doesn't support pointers explicitly.
But java uses pointer implicitly:-
Java uses pointers for manipulations of references
but these pointers are not available for outside use.
A pointer is only used as an address of a memory location.
The java variales of oject type store the reference of the oject.
Basically the programmer can't write the pointer program in java.
Example 2: java pointer
There are no pointers in Java. However, there is a Pointer class in JNA, which is very likely NOT what are you looking for.
The only way to get and use pointers is through using Unsafe. The mechanisms are implementation-dependent between JDKs and the Unsafe class may be available at sun.misc.Unsafe or at jdk.internal.misc.Unsafe.