Code:
import java.util.*;
import java.io.*;

class Sex{
	public static void main(String[] args)throws IOException{
	Book[]book = new Book[10];
	
Scanner in = new Scanner(new FileReader("love.txt"));
String data;


int a = 0;
data = in.nextLine();
while (!(data.equals("END")))
{
   //System.out.println(data);
   
   book[a]= new Book(in.next(),in.next(),in.next(),in.next(),in.next(),in.next(),in.next());
   a++;
   
   data = in.nextLine();
}
in.close();

	
	}
}
I can read the file a line at a time, but when I try to parse it, it generates the NoSuchElementException. The elements in the file is separated by spaces. What could this problem be. How do I rectify it? I have been working on it for a very long time.


Dietel0004 Java How To Program c OUT Dietel & Dietel Prentice Hall 23-05-08 NULL
9Mec000980 Popular Mechanics r IN N/A N/A
MS00897666 Learn XP s IN George Gobin Microsoft
Lafore0037 Data Structures & Algorithms In Java c OUT Robert Lafore Sams 07-08-08
6Tech00472 Tech Magazine r IN N/A N/A
END