java中,读取第一行文本是str=fin.readLine();怎么读取接下来的第二行,第三行...

如题所述

String line ;
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
line = reader.readLine(); // 读取第一行
while (line!=null) { // 如果 line 为空说明读完了
sb.append(line); // 将读到的内容添加到 buffer 中
sb.append("\n"); // 添加换行符
line = reader.readLine(); // 读取下一行 **
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-11-28
这个还不简单 循环读 这个是读下一行的意思

str=fin.readLine();
while(str!=null){
做其他操作。。;
str=fin.readLine();
}本回答被提问者采纳
第2个回答  2011-11-30
你看看啊,redline不就是读一行嘛,
读第二行就用这句就行了啊
相似回答