[上]JAVA学习系列模块九第五章188.方法参数_基本类型做参数传递
视频
笔记
基本数据类型做方法参数传递
[tip type=”info” display=”custom-class”]基本类型做方法参数传递,传递的是值,不是变量本身
方法运行:压栈
方法运行完毕:弹栈 -> 释放栈内存[/tip]
public class Demo01Param {
public static void main(String[] args) {
int a = 10;
int b = 20;
method(a,b);
System.out.println(a);//10
System.out.println(b);//20
}
public static void method(int a,int b){
a+=10;
b+=20;
System.out.println(a);//20
System.out.println(b);//40
}
}

