日期:2014-05-20 浏览次数:20804 次
import java.util.*;
public class Test
{
public static void main(String[] args)
{
Scanner in = new Scanner("E:\\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);
}
scanner.close(); // also closes the FileReader