Keep getting error message "Exception in thread "main" java.util.NoSuchElementException"
<p>Here is my code</p>

<pre><code>public class NEW {
    String Firstname;
    String Lastname;
    String Position;
    int Jnum;
    String Team;

    public static void main(String[] args)   throws Exception {

        String a =  JOptionPane.showInputDialog("Enter in 0 to sort by First Name\nEnter in 1 to sort by Last Name\n" +

                "Enter in 2 to sort by position\nEnter in 4 to sort by Team names");

        int q = Integer.parseInt(a);    
        File input  = new File("Roster.txt");
        Scanner players = new Scanner(input);
        NEW []  array = new NEW [435];
        int x=0;
        while (players.hasNext()){
            array[x] = new NEW();
            array[x].Firstname  = players.next();
            array[x].Lastname  = players.next();
            array[x].Position  = players.next();
            array[x].Jnum  = players.nextInt();
            array[x].Team  = players.next();
        }
       JOptionPane.showMessageDialog(null, array.toString()," ", JOptionPane.INFORMATION_MESSAGE);

    players.close();
    }

    public static NEW[] BubbleSort(int num, NEW []array){
       int p=0;

       if (num==0){
       String temp = null;
           for(int k =1;k&lt;435;k++){
        for(int i=0;i&lt;435-k;i++){
            if(array[i].Firstname.compareTo(array[i+1].Firstname)&gt;0){
              temp = array[i].Firstname;
            array[i].Firstname=array[i+1].Firstname;
            array[i+1].Firstname= temp;
            }
            p++;
        }
    }


return array;
    }


    if (num==1){
        String temp = null;
        for(int k =1;k&lt;435;k++){
        for(int i=0;i&lt;435-k;i++){
            if(array[i].Lastname.compareTo(array[i+1].Lastname)&gt;0){
              temp = array[i].Lastname;
            array[i].Lastname=array[i+1].Lastname;
            array[i+1].Lastname= temp;
            }
            p++;
    }

}
return array;
}


       if (num ==2){
           String temp = null;
           for(int k =1;k&lt;435;k++){
        for(int i=0;i&lt;435-k;i++){
            if(array[i].Position.compareTo(array[i+1].Position)&gt;0){
              temp = array[i].Position;
            array[i].Position=array[i+1].Position;
            array[i+1].Position= temp;
            }
            p++;
       }


           }

       return array;
       }


       if (num ==3){
           int temp = 0;
           for(int k =1;k&lt;435;k++){
        for(int i=0;i&lt;435-k;i++){
            if(array[i].Jnum&gt;(array[i+1].Jnum))
              temp = array[i].Jnum;
            array[i].Jnum=array[i+1].Jnum;
            array[i+1].Jnum= temp;
            p++;
       }


           }

       return array;
       }


       if (num ==4){
           String temp = null;
           for(int k =1;k&lt;435;k++){
        for(int i=0;i&lt;435-k;i++){
            if(array[i].Team.compareTo(array[i+1].Team)&gt;0){
              temp = array[i].Team;
            array[i].Team=array[i+1].Team;
            array[i+1].Team= temp;
            }
            p++;
       }


           }

       return array;
       }

       else return array;





    }
}
</code></pre>
