代码:
public class TempTest {public static void main(String[] args) {
int temp=0
int a=1
int b=2
temp = a + b
//在这里就是将a与b的和赋给了temp这个变量
System.out.println("temp = a + b======>"+temp)
temp = a
//因为a是1,所以就是把a=1赋给了temp;
System.out.println("temp = a======>"+temp)
a=b
//在这里因为b的值是2,所以就是把b=2赋给了a
System.out.println("a=b=======>"+a)
}
}
效果:
temp = a + b======>3temp = a======>1
a=b=======>2
希望能帮到你。