In Java, only references, not pointers;
In fact, what does the reference in Java have to do with pointers in c++/c?
There are several basic types of data in Java: Boolean,int,float,double,byte ....
1. For a non basic type, a reference to a variable in Java (that is, the variable you define) is actually equivalent to the pointer
2. For basic types, this is not the case. The basic type in Java is the value itself, not the reference
Talk is cheap,show your My Code
public class intarray{public
static void Main (string[] args) {
int x=0;
Intarray intarray=new Intarray ();
Intarray.method (x);
SYSTEM.OUT.PRINTLN (x);
}
public void method (int x) {
x=2
}
}
The result of the output is still 0; the value of x is not modified, that is, the start of X being passed in the value itself, not the reference to X (that is, the conceptual pointer).
Note, however, that if you pass an array name of the base type, it is also equivalent to passing an array pointer in C + +.