它正在打印一條直線,但我希望它能打印出每一個字的新行。 這就是現在的樣子one, two, three
。如何更改我的代碼以便每次都在新生產線上打印出來?
while (true) {
String word = reader.readLine();
if("end".equalsIgnoreCase(word)) {
break;
}
list.add(word);
}
System.out.println(list);
使用循環遍歷列表並使用'System.out.println'在單行中打印每個項目。 –
其ArrayList –
@Predict_it儘管如此,每個使用。 :) –