0
File customer = new File("Cus.txt");
Scanner readCustomer = new Scanner(customer);
while(readCustomer.hasNextLine())
{
String line = readCustomer.nextLine();
String delims = ", ";
String[] split = line.split(delims);
int arr = Integer.parseInt(split[0]);
int ser = Integer.parseInt(split[1]);
int qui = Integer.parseInt(split[2]);
int appt = Integer.parseInt(split[3]);
int appL = Integer.parseInt(split[4]);
Customer newCustomer = new Customer(arr, ser, qui, appt, appL);
customerList.add(newCustomer);
System.out.println("Customer arrival: " + newCustomer);
}readCustomer.close();
912, 4, 922, 0, 0
915, 5, -1, 10, 10
918, 0, -1, 5, 5
920, 0, -1, 10, 10
925, 6, 930, 0, 0
CUS.TXT FILE
915, 5, -1, 925, 10,
918, 0, -1, 920, 5,
920, 0, -1, 915, 10,
925, 6, 930, -1, 0,
我是認真在虧損,而且不知道如何解決這個問題。有沒有人看到任何錯誤或爲什麼它不能讀取我的分裂[4]?爲什麼要複製int appt值中的內容?
我懷疑你的Custom構造函數中有一個錯誤,它解釋了重複的'appL'。或者那個或者toString()方法。 – Gray
我會學習使用調試器來解決這個問題。 http://www.vogella.com/tutorials/EclipseDebugging/article.html – Gray
請您向我們展示客戶構造函數的實現 –