/*Node.java*/
import java.io.File;
import java.util.Scanner;
import java.io.FileInputStream;
import java.io.IOException;
public class Node{
public static void main(String args[]){
File file = new File("D:\\text.txt");
try{
Scanner scanner = new Scanner(new FileInputStream(file),"gbk");
while(scanner.hasNextLine(){
System.out.println(scanner.nextLine());
}
scanner.close();
}catch(IOException e){
scanner.close();
System.out.println("exception");
}
}
}
javac编译
java运行即可