我覺得我以錯誤的方式討論這段代碼。基本上我正在嘗試從文本文件加載客戶端信息。我麻煩的代碼看起來像這樣...Java找不到構造函數
//load clients data from file
file = new File(clientsOutputFile);
sc = new Scanner(file);
Client client;
String givenName, familyName;
String industry, projectName;
// iterate for each line in veneues file
while(sc.hasNextLine()) {
str = sc.nextLine();
// split line by tab
parts = str.split("\t");
// check if all details of client are provided
if(parts.length == 5) {
phone = Integer.parseInt(parts[0]);
givenName = parts[1];
familyName = parts[2];
industry = parts[3];
projectName = parts[4];
client = new Client(phone, givenName, familyName, industry, projectName);
// add client to client's model
clientMdl.addElement(client);
}
}
sc.close();
,我收到編譯時是錯誤...
Error: /Users/Desktop/Migration/BookingGUI.java:647: cannot find
symbol
symbol : constructor Client(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
location: class Client
任何的幫助深表感謝。
客戶端類的構造函數沒有與您的參數相匹配的構造函數。 – Bubletan 2015-04-02 22:59:56
沒有看到'Client'的代碼,很難知道如何幫助你。想必它只是沒有那個構造函數......所以添加它,或者使用* does *存在的構造函數。 – 2015-04-02 23:00:55