逐行扫描文件,并逐行输出
public static void main(String[] args) throws FileNotFoundException
{
InputStream in = new FileInputStream(new File("C:\\windows"));
Scanner s = new Scanner(in);
while(s.hasNextLine()){
System.out.println(s.nextLine());
}
}
InputStream in = new FileInputStream(new File("C:\\windows"));
Scanner s = new Scanner(in);
while(s.hasNextLine()){
System.out.println(s.nextLine());
}
}