I am reading a string from a file, and parse the string and the different elements into an array for later manipulation.
Every thing works fine, however when printing elements inside the WHILE loop it works, however, when I try to print the array out of the while loop I get an array Null pointer. Here is the code :
public PointsEX2(){
        String temp = new String();
        String[] parse =null;
        File file = new File("C:/Users/DjKidoo/Desktop/IA/mof.txt");
        Scanner sc = null;
        for(int t=0;t<pt_tab1.length;t++){
            pt_tab1[t]=new PointEX2();
        }
        try {
            sc = new Scanner(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        int j=0;
        while ((sc.hasNextLine())&& (j<= pt_tab1.length)) {
            temp = sc.next();
            parse = temp.split(",",0);
            pt_tab1[j]= new 
  PointEX2(Float.parseFloat(parse[0]),Float.parseFloat(parse[1]),Float.parseFloat(parse[2]),Float.parseFloat(parse[3]),parse[4]);
 System.out.println(toString(pt_tab1[j])); // perfectly works
        }
        for (int i=0;i<pt_tab1.length;i++)
        System.out.println(pt_tab1[i].x); // Array Null Pointer
}
 
     
    