cho file text, mỗi dòng file có các kiểu dữ liệu đan xen lẫn nhau
Ví dụ : Le Van Nam 2000 Phan Chau Trinh true 9 8 8.5
// Le Van Nam 2000 Phan Chau Trinh true 9 8 8.5
Scanner kb = new Scanner(System.in);
String read = kb.nextLine();
Scanner line = new Scanner(read);
// doc ten
String ten="";
while(!line.hasNextInt()) ten = ten +line.next()+" ";
// doc nam sinh
int tuoi = line.nextInt();
// doc ten truong
String truong ="";
while(!line.hasNextBoolean()) truong = truong + line.next()+" ";
// doc gioi tinh
boolean gioiTinh = line.nextBoolean();
// doc diem
double mon1= line.nextDouble();
double mon2 = line.nextDouble();
double mon3 = line.nextDouble();