`

java读取txt

 
阅读更多
public static void main(String[] args) {
        try {
            BufferedReader in = new BufferedReader(new FileReader("F:\\test.txt"));
            String   line   =   null;
            try {
                while((line   =   in.readLine())!=null)
                {
                    System.out.println(line   );
                }
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 
    }

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics