![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
求详细解答这个java程序的解答和步骤,请详细点,谢谢
1个回答
展开全部
您好
1.先用2个变量存左右手牌 和一个中间变量
int left(左) = 8;
int right(右) = 10;
int temp(中间变量) ;
2. 换值
temp = left(左);
left = right(右);
right(右) = temp;
程序实现 可ctrl+c 直接可用 纯属手打 可以采纳
public class Demo{
public static void main(String[] args){
int left = 8;
int right = 10;
int temp ;
System.out.println("互换前:");
System.out.println("左边为:"+left);
System.out.println("右边为:"+right);
temp = left(左);
left = right(右);
right(右) = temp;
System.out.println("互换后:");
System.out.println("左边为:"+left);
System.out.println("右边为:"+right);
}
}
1.先用2个变量存左右手牌 和一个中间变量
int left(左) = 8;
int right(右) = 10;
int temp(中间变量) ;
2. 换值
temp = left(左);
left = right(右);
right(右) = temp;
程序实现 可ctrl+c 直接可用 纯属手打 可以采纳
public class Demo{
public static void main(String[] args){
int left = 8;
int right = 10;
int temp ;
System.out.println("互换前:");
System.out.println("左边为:"+left);
System.out.println("右边为:"+right);
temp = left(左);
left = right(右);
right(右) = temp;
System.out.println("互换后:");
System.out.println("左边为:"+left);
System.out.println("右边为:"+right);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询