Read a text file, store it in an array and print out the array.
I have this code which reads a text file then store the contents of it in an array and print out the array. I have this error message :"java.util.NosuchElementException" Please tell me what wrong.
public class ReadFile
public static void main(String  args)throws IOException
String line, items, infile = "myFile.txt";
String  OutArray;
OutArray = new String;
int index = 0;
BufferedReader stdin = new BufferedReader(new FileReader (infile));
line = stdin.readLine();
while (line != null)
tknz = new StringTokenizer (line);
items = tknz.nextToken();
Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.