title: I've got a problem in case 2 of the switch that gives me the NoSuchElementException?
body: <p>I have the following code that works correctly at the school in a Windows computer, but it doesn't work in my MacOS. Case 2 should give a student's class number but it is giving me the <code>NoSuchElementException</code> only in my MacOS. Why it doesn't work in my MacOS?</p>
  
  <pre><code>case 2:
              System.out.println("Inserisci il cognome dello studente");
              String surname = scan.next();
              System.out.println("");
              System.out.println("Inserisci il nome dello studente");
              String name = scan.next();
              System.out.println("");
  
              File directory = new File("files" + File.separator + "class");;
              int fileCount = directory.list().length;
              for(int i=0; i&lt; fileCount; i++ ){
                  cn = ClassNumber.values()[enumNumb];
                  if(enumNumb&lt;3){
                      for(int j = 1; j&lt;6; j++){
                          File serchStudents = new File("files" + File.separator + "class//" + j + cn + ".txt");
                          Scanner scS = new Scanner(serchStudents);
                          while(scS.hasNextLine()){
                              if(surname.equals(scS.next())/*&amp;&amp; name.equals(sc.next())*/){
                                  System.out.print(j);
                                  System.out.println(cn);
                                  enumNumb=0;
                              }
                          }
                      }
                      enumNumb++;
                  }
                  if(enumNumb&gt;=3){
                      for(int j = 3; j&lt;6; j++){
                          File serchStudents = new File("files" + File.separator + "class" + File.separator + j + cn + ".txt");
                          Scanner scS = new Scanner(serchStudents);
                          while(scS.hasNextLine()){
                              if(surname.equals(scS.next())/*&amp;&amp; name.equals(sc.next())*/){
                                  System.out.println("Lo studente fa parte della classe : ");
                                  System.out.print(j);
                                  System.out.println(cn);
                                  i=fileCount;
                                  enumNumb=0;
                              }
                          }
                      }
                      enumNumb++;
                  }
              }
              System.out.println("Vuoi fare altro ?");
              answer = scan.next();
              break;
  </code></pre>