(二十)两种数据类型的对比
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); } }
作者:狗尾草
-------------------------------------------
个性签名:海到无边天作岸,山登绝顶人为峰!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!