I am trying to read a file and store the row entries into an object using the following code:
package eclipsePackage;
import java.io.*;
import java.util.*;
public class MainProg {
    public static void main(String[] args) throws IOException{
        Scanner file=null;
                try{ 
                    file=new Scanner(new File("notes.txt"));
                }catch(Exception e){
                    System.out.println("unable to open the file");
                }
                    Ages arr[]=new Ages[5];
                    for(int i=0; i<5;i++){
                            arr[i].readData(file);
                    }
                    file.close();
                    System.out.println("Name"+"\t"+"Age"+"\t"+"Year of Birth");
                    for(int i=0;i<5;i++){
                        arr[i].outputData();
                    }
                }
            }
The method that reads the file is in a class called Ages.
But I'm getting the error: Exception in thread "main" java.lang.NullPointerException
    at eclipsePackage.MainProg.main(MainProg.java:16)
Can someone help me fix it
 
     
     
    