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 ;
There are a few syntax errors in the code. Here's the corrected version:
class TestIt {
public static void main(String[] args) {
int[] myArray = {1, 2, 3, 4, 5};
ChangeIt.doit(myArray);
for (int j = 0; j < myArray.length; j++) {
System.out.print(myArray[j] + " ");
}
}
}
class ChangeIt {
static void doit(int[] z) {
z = null;
}
}
In the main method, I have corrected the syntax for the array initialization and added missing curly braces for the for loop. In the ChangeIt class, I have corrected the method name from "dort" to "doit"
原文地址: http://www.cveoy.top/t/topic/i0EC 著作权归作者所有。请勿转载和采集!