java。在txt文档中读取字符串,只能读一行。换行的读不出来。

2025-02-22 09:58:46
推荐回答(2个)
回答1:

String s="";
String line=null;
while((line=br.readLine())?=null){
s+=line+"\r\n";

}

System.out.println(s);

回答2:

while循环