62,614
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) throws IOException {
FileInputStream file=new FileInputStream("test.txt");
BufferedReader reader=new BufferedReader(new InputStreamReader(file));
StringBuilder content=new StringBuilder();
String line=null;
while((line=reader.readLine())!=null)
{
content.append(line);
content.append(System.getProperty("line.separator"));
}
file.close();
reader.close();
System.out.println(content.toString());
}