的各個元素,我很新的節目,我必須在這裏失去了一些東西。第一部分起作用。第二部分發生錯誤。這是爲什麼?JAVA - 問題初始化數組的
// this works
private static int[] test2 = {1,2,3};
// this is ok
private static int[] test1 = new int[3];
// these three lines do not work
// tooltip states ... "cannot find symbol. class test1. ']' expected."
test1[0] = 1;
test1[1] = 2;
test1[2] = 3;
這應該工作,你可能想發佈完整的代碼 – 2010-08-13 04:04:29
你可以請你發佈你的整個java文件?根據您當前的問題很難確定您粘貼的範圍。 – Catchwa 2010-08-13 04:05:26