跟我学Java第130页
//实现数组的元素倒置
for (int i=0;i<array.length/2-1;i++)
{ array[i]=array[i]+array[array.length-1-i]; array[array.length-1-i]=array[i]-array[array.length-1-i]; array[i]=array[i]-array[array.length-1-i]; }//正确语法应该为:
for (int i=0;i<array.length/2;i++)
{ array[i]=array[i]+array[array.length-1-i]; array[array.length-1-i]=array[i]-array[array.length-1-i]; array[i]=array[i]-array[array.length-1-i]; }