public static void main(String[] args) {
int a = 10;
int b = 20;
change(a,b);
System.out.println("a:"+a+",b:"+b); //a:10,b:20
}
1
public static void main(String[] args) {
2
int a = 10;
3
int b = 20;
4
change(a,b);
5
System.out.println("a:"+a+",b:"+b); //a:10,b:20
6
}
public static void change(int a, int b) {
a = b;
b = a + b;
System.out.println("a:"+a+",b:"+b); //a:20,b:40
}
6
6
1
public static void change(int a, int b) {
2
a = b;
3
b = a + b;
4
System.out.println("a:"+a+",b:"+b); //a:20,b:40
5
}
6