package com.lina.util;
import java.util.Arrays;
import java.util.Scanner;
public class Arraylists {
public static void main(String[] args) {
getchange1();
getchange2();
getchange3();
getchange4();
getchange5();
}
//交换位置的方法
public static void getchange1(){
int x=3,y=9;
x=x^y;
y=x^y;
x=x^y;
System.out.println("getchange1:x="+x+";y="+y);
}
//加减法
public static void getchange2(){
int x=3,y=9;
x=x+y;
y=x-y;
x=x-y;
System.out.println("getchange2:x="+x+";y="+y);
}
public static void getchange3(){
int x=3,y=9;
x=x-y;
y=x+y;
x=y-x;
System.out.println("getchange3:x="+x+";y="+y);
}
//乘除法
public static void getchange4(){
int x=3,y=9;
x=x*y;
y=x/y;
x=x/y;
System.out.println("getchange4:x="+x+";y="+y);
}
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
输出:
getchange1:x=9;y=3
getchange2:x=9;y=3
getchange3:x=9;y=3
getchange4:x=9;y=3