1
如何将用户键盘输入中的每个答案存储在字符串中?如何在字符串中存储用户输入?
for (int i = 0; i < 3; i++){
System.out.println("insert the answer ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String userAnswer[] = new String[3];
try {
userAnswer[i] = br.readLine();
} catch (IOException ioe) {
System.out.println("IO error ,trying to read your answer");
System.exit(1);
}
int count =0;
count++;
String we[] = new String[3];
System.out.println("the answer is " + userAnswer);
System.out.println("the answer is " + count);
}
这段代码有什么问题? – 2011-01-10 14:28:06
您是否试图接受单个输入并将其分为三个字符串?你想输入三个单独的字符串吗?你的意图不明确。 – Jeremy 2011-01-10 14:28:06