Java新手,使用模板工作。任何想法有什麼不對?我正在使用Netbeans IDE並將java文件上傳到Linux機器,然後在那裏編譯。Java編譯錯誤:找不到符號(EraserThread)
PasswordField.java:42: cannot find symbol
symbol : class EraserThread
location: class PasswordField
EraserThread et = new EraserThread(prompt);
^
PasswordField.java:42: cannot find symbol
symbol : class EraserThread
location: class PasswordField
EraserThread et = new EraserThread(prompt);
^
2 errors
public class PasswordField {
public static String readPassword (String prompt) {
EraserThread et = new EraserThread(prompt);
Thread mask = new Thread(et);
mask.start();
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String password = "";
try {
password = in.readLine();
} catch (IOException ioe) {
ioe.printStackTrace();
}
// stop masking
et.stopMasking();
// return the password entered by the user
return password;
}
}
那麼EraserThread類在哪裏聲明? –
import EraserThread class .. – subash
對不起,我很新的這個,但這是一個模板在網上找到,我得到的錯誤是說它找不到類...我只是應該創建一個空的EraserThread類?模板就是這樣給出的。 – Erin