java异或实现两个数据交换

    public void contextLoads() {
        int a=5;
        int b=4;
        a = a^b;
        b= a^b;
        a = a^b;
        System.out.println("a=" +a);
        System.out.println("b=" +b);
    }

 

posted @ 2020-05-21 17:22  Nullpointer_dxy  阅读(208)  评论(0编辑  收藏  举报