它正在打印一条直线,但我希望它能打印出每一个字的新行。 这就是现在的样子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尽管如此,每个使用。 :) –