0
我是Java新手。我在讀這本書以編程的介紹使用Java V7和發現問題,這樣的代碼:TextIO.getln()沒有得到輸入?
public class CreateProfile {
public static void main(String[] args) {
// TODO Auto-generated method stub
String name;
String email;
double salary;
String favColor;
TextIO.putln("Good Afternoon! This program will create");
TextIO.putln("your profile file, if you will just answer");
TextIO.putln("a few simple questions.");
TextIO.putln();
/* Gather responses from the users. */
TextIO.put("What is your name? ");
name = TextIO.getln();
TextIO.put("What is your email address? ");
email = TextIO.getln();
TextIO.put("what is your salary income? ");
salary = TextIO.getDouble();
TextIO.putln();
TextIO.put("What is your favorite color? ");
favColor = TextIO.getln();
/* Write the user's information to the file named profile.txt. */
TextIO.writeFile("profile.txt"); //subsequent output goes to file
TextIO.putln("Name: " + name);
TextIO.putln("Email: " + email);
TextIO.putln("Favorite Color: " + favColor);
TextIO.putf("Yearly Income: %1.2f%n", salary);
/* Print a final message to standard output. */
TextIO.writeStandardOutput();
TextIO.putln("Thank you. Your profile has been written to profile.txt.");
}
}
控制檯不要求我輸入最喜歡的顏色而是直接跳轉到寫文件的過程。
誰能請解釋一下我爲什麼?
你濫用javers標籤,請刪除它(只留下java) –
嗨,什麼是javers標籤?我相信我只使用了帶有TextIO類的Java? – Rubit
好的我想我知道你在說什麼。謝謝。 – Rubit