我是Java的新手,写了这个类来尝试几个数组选项..你能请教printarray方法中的错误是什么..Eclipse给我指出了一个错误,但我无法调试
public class arrarytest {
public static void main(String args[]){
int[] x = {1,2,3,4};
for(int y:x){
System.out.println(y);
}
double[] mylist = {1.9,2.9,3.9,4.9};
for (int i =0; i<mylist.length; i++){
System.out.println(mylist[i]);
}
double total = 0;
for (int i =0; i < mylist.length; i++){
total +=mylist[i];
}
System.out.println("Total is="+ total);
public static void printArray(int[] array) {
for (int i = 0; i < array.length; i++) {
System.out.print(array[i] + " ");
}
}
}
}