public class Test
{
public static void main(String[] args)
{
Scanner in = new Scanner("D:\\java\\abc.txt");
}
} ------解决方案-------------------- Scanner in = new Scanner(new File("D:\\java\\abc.txt")); ------解决方案--------------------
FileReader fileReader =new FileReader("hrinfo1.txt");
// create a scanner from the data file
Scanner scanner = new Scanner(fileReader);
// repeat while there is a next item to be scanned
while (scanner.hasNext()) {
// retrieve each data element
String name = scanner.next();
int age = scanner.nextInt();
String time = scanner.next();
boolean bool = scanner.nextBoolean();
System.out.println(name+" "+age+" "+time+" "+bool);
}