以下输出是什么 ?class LowHighSwap{ static void doIt( int[] z ) { int temp = z[z.length-1]; z[z.length-1] = z[0]; z[0] = temp; }}class TestIt{ public static void main( String[] args ) { int[] myArray = {1, 2, 3, 4, 5}; LowHighSwap.doIt(myArray); for (int i = 0; i < myArray.length; i++) { System.out.print(myArray[i] + " "); } }}
(A)1 2 3 4 5
(B)5 2 3 4 1
(C)1 2 3 4 1
(D)5 2 3 4 5
参考答案
继续答题:下一题


更多java基础知识试题
- 1Java语言具有许多优点和特点,哪个反映了Java程序并行机制的特点?( )
- 2this和super: ( )
- 3下述代码的执行结果是class Super { public int getLength() { return 4; }}public class Sub extends Super { public long getLength() { return 5; } public static void main (String[]args) { Super sooper = new Super (); Super sub = new Sub(); System.out.printIn(sooper.getLength()+ “,” + sub.getLength() ); }}
- 4Linux系统是一个( )的操作系统
- 5下列不是用来捕获处理异常的关键字是( )