/**
* @FIENDLMAO
* 2021/3/24
*
* 小明左右手分别那两张牌:黑桃10和红心8,现在交换手中的牌。
* 编写一个程序模拟这个过程:两个整数分别保存在两个变量中,将这两个变量的值互换,并输出互换后的结果。
*/publicclassDataExchange{publicstaticvoidmain(String[] args){int left =10;//定义变量 left 为左手int right =8;//定义变量 right 为右手int temp;//temp 为临时变量,用于交换
System.out.println("输出交换前的牌");
System.out.println("左手中的纸牌"+left);
System.out.println("右手中的纸牌"+right);
temp = left;//将left的值交给临时变量 temp
left = right;//将 right 的值交给 left
right = temp;//将临时变量 temp 的值交给 right
System.out.println("输出交换后的牌");
System.out.println("左手中的纸牌"+left);
System.out.println("右手中的纸牌"+right);}}