我知道這是重復的,但其他人似乎都沒有幫助解決我的問題,而且我在 Google 上找不到任何有幫助的東西。這是我的代碼:import java.util.Scanner;class File_Scanner{ public static void read(){ try { File credentials_file = new File("credentials.txt"); Scanner file_reader = new Scanner(credentials_file); String[] users = new String[6]; int index_counter = 0; while (file_reader.hasNextLine()) { users[index_counter] = file_reader.nextLine(); index_counter++; } file_reader.close(); } catch (Exception e) { System.out.println(e.getClass()); } System.out.println(users[0]); }}我得到的錯誤是:File_Scanner.java:19: error: cannot find symbol System.out.println(users[0]); ^ symbol: variable users location: class File_Scanner1 error感謝您所有的幫助!你們是最棒的!
添加回答
舉報
0/150
提交
取消