import java.io.File; import java.util.Scanner; class Demo { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(new File("d:\\abc.txt")); System.out.println("文件内容如下:"); while (sc.hasNextLine()) { System.out.println(sc.nextLine()); } } }
用Scanner读文本文件内容
猜你喜欢
转载自www.cnblogs.com/bingxing/p/9102745.html
今日推荐
周排行