One, Java is divided into two types of memory:
1, stack memory, used to store the basic types of variables and object reference variables;
2, heap memory, used to store the new keyword to create objects and arrays;
Two, Java method of parameter transfer mode only one-value transfer, that is, the actual parameters are copied into the method, the actual parameters themselves will not be any impact, reference to the C language function parameters passed, the form of participation in the actual parameters (at the time when the study is really good halo);
Third, the first paragraph of the Exchange code (basic type parameters)
public class Javatest {public
static void (int a, int b)
{
//Exchange a,b value
int temp = A;
A = b;
b = temp;
System.out.println ("After swapping, the values of A and B in the swap method are:" + A + " " + b);
}
public static void Main (string[] args)
{
int a = 3;
int b = 9;
Swap (A, b);
System.out.println ("After the exchange is performed, the values of A and B in the main method are:" + A + " " + b);
}
Execution results:
Schematic diagram:
The second paragraph Exchange code (object is parameter)
Class Base
{public
int A;
public int b;
}
public class Javatest {
the value of the A,b property in the public static void swap (base base) {
//Exchange base Object
int temp = BASE.A;
Base.a = base.b;
base.b = temp;
System.out.println ("After the swap, the value of the A and B properties of the base object in the Swap method is" + Base.a + "" + base.b);
}
public static void Main (string[] args)
{
base base = new Base ();
Base.a = 3;
base.b = 9;
Swap (base);
System.out.println ("After the exchange is performed, the value of the A and B properties of the base object in the Main method are:" + Base.a + "" + base.b);
}
Execution results:
Schematic diagram:
(Recommend a big God's blog, aloof Wolf's blog, http://www.cnblogs.com/xdp-gacl/
His blog covers the Java and Java Web Nearly all important will be used to explain the basics, I think learning to be more sharing, I am learning the Java Web, I hope to communicate with you, thank you