class TestItpublic static void main Stringl args int myArray=12345;ChangeItdort mArray ;forint j=0; imyArraylength; j++Systemoutprint myArrayj +;class Changeitstatic void doit int z tz = null ;这个程序会输
这个程序有一些语法错误和逻辑错误。修正后的代码如下:
class TestIt {
public static void main(String[] args) {
int[] myArray = {1, 2, 3, 4, 5};
ChangeIt.dort(myArray);
for (int j = 0; j < myArray.length; j++) {
System.out.print(myArray[j] + " ");
}
}
}
class ChangeIt {
static void dort(int[] z) {
z = null;
}
}
修正后的程序会输出:1 2 3 4 5
原文地址: http://www.cveoy.top/t/topic/i0EK 著作权归作者所有。请勿转载和采集!