import java.io.File; import java.util.Scanner; public class hello { public static void main(String[] args) throws Exception { File file=new File("D:\jodie\java\newfile.txt"); //创建一个文件对象 Scanner sc=new Scanner(file,"utf-8");//创建Scanner对象
System.out.println(sc.nextLine()); //读取一行
System.out.println(sc.nextLine());
}
}