class Demo2
{
    public static void main(String[] args) {
        //int m=5,n=6;
        //huan(m,n);
        int[] a = new int[3];
        a[0] = 5;
        a[1] = 4;
        huan(a);//a[0]=4;a[1]=5;
    }
    public static void huan(int[] arr) {
        int c;
        c = arr[0];
        arr[0] = arr[1];
        arr[1] = c;
        System.out.println("a[0]=" + arr[0] + "a[1]=" + arr[1]);
    }
    public static void huan(int a,int b) {
        int c;
        c = a;
        a = b;
        b = c;
        System.out.println("a=" + a + "b=" + b);
    }
}

  

作者:狗尾草
 

-------------------------------------------

个性签名:海到无边天作岸,山登绝顶人为峰!