1 data types in Java:
There are 8 basic data types, namely: Byte (1), Boolean (1), char (2), short (2), int (4), Long (8), float (4), double (8) The number of bytes represented in parentheses
There are 3 types of reference: class reference, interface reference, array reference
2 How to pass in Java: and. Address delivery.
1) Value passing:
such as the following methods
public void Add (int a) {
int b = A;
}
This can be thought of as a value pass, A is a basic data type, and he passes his value to B.
2) Address delivery:
public void Add (Object obj) {
Object objtest = obj;
}
This is the site pass, which is the reference pass, and obj is the reference data type, which assigns the value of the address of the object in his stack to the heap to objtest.
At this point, there are two references to one of the object objects in the heap
Summary:
If it is a basic data type, the actual value is passed.
If it is a reference data type, the address value of the reference is passed.
Reference passing in Java (same for JS)