Reading and displaying data from a .txt file

后端 未结 10 958
北海茫月
北海茫月 2020-11-27 15:41

How do you read and display data from .txt files?

10条回答
  •  情话喂你
    2020-11-27 15:50

    If you want to take some shortcuts you can use Apache Commons IO:

    import org.apache.commons.io.FileUtils;
    
    String data = FileUtils.readFileToString(new File("..."), "UTF-8");
    System.out.println(data);
    

    :-)

提交回复
热议问题