1.
A reference type indicates that the data you are manipulating is the same, that is, when you pass a parameter to another method and you change the value of the variable in another method, the value of the variable passed in when the method is called will also change .
A value type means copying a current variable to a method, and when you change the value of the variable in this method, the value of the initial life variable does not change .
2.
Value types are common basic data types: numeric, character, Boolean
Reference type: All types except basic data types are referred to as reference types
3.
For example, there is a rectangle in memory (assuming), with a number n
Value types are basic data types, such as Int,float,byte,double,boolean,char.
Value passing is a copy of the number of n in the rectangle to other parameters or methods, no matter how you operate, the rectangle and the number of n does not change.
Reference types are objects, such as arrays, strings, and so on.
Reference passing is to pass the rectangle's address to another parameter or method, the other parameter or method will get the number n through this address, if the operation of this address, the value of the rectangle will change.
The action is on its replicator relative to the value type, and the operation is on its own relative to the reference type.
4, value delivery: The basic data type assignment is the value of the pass, the value passed is a real variable value, is the transfer of the original parameter copy, the value is passed, the argument is passed to the value of the parameter, the parameter changes without affecting the argument.
Reference passing: Assignment between reference types is a reference pass. Reference passing is the object's reference address, which is itself (its own most popular understanding). Reference passing: The address is passed, that is, the address of the argument to the formal parameter
, the parameters are changed, and the arguments are changed, because they point to the same address.
Value types and reference types