title: How to repeat this small program until EOF
body: <p>The last piece that I want to add to this program is so that it will repeat after printing the results until EOF is pressed. Here is my code</p>
  
  <pre><code>public static void main(String args[])
  {
      Scanner stdin = new Scanner(System.in);
  
      System.out.println("Please enter a positive integer &gt; 2. Press EOF to quit: ");
      int num = stdin.nextInt();       
      while(stdin.hasNextInt)
      {
          if(num &lt; 3)
          {
              System.out.println("Your input " + num + " is not a positive integer &gt; 2");
          }
          else
          {
              int prime = 0;int pnum = 0;int dnum = 0;int anum = 0;
              for(int i = 2;i &lt;= num;i++)
              {
                  if(NumberClassifier.isPrime(i)==true)
                  {
                      prime++;
                  }
                  if(NumberClassifier.classify(i)==1)
                  {
                      pnum++;
                  }
                  else if(NumberClassifier.classify(i)==2)
                  {
                      dnum++;
                  }
                  else if(NumberClassifier.classify(i)==3)
                  {
                      anum++;
                  }
              }
              System.out.println("In the range of 2 - " + num + " there are:");
              System.out.println(prime + " prime numbers");
              System.out.println(pnum + " perfect numbers");
              System.out.println(anum + " abundant numbers");
              System.out.println(dnum + " deficient numbers");
              System.out.println("Please enter a positive integer &gt; 2. Press EOF to quit: ");
          }
      }
      //System.out.println("Please enter a positive integer &gt; 2. Press EOF to quit: "); ( dont know where this should be)
  
  }
  </code></pre>
  
  <p>This program takes an integer and runs the range of 2 - the integer through 2 methods which count the prime, abundant, deficient and perfect numbers in the range. I just want to get the input printed and then print the instructions again and run until EOF is pressed. I tried using a while loop to only continue the program while the scanner has an integer but that didnt seem to work at all.
  Any help would be greatly appreciated.</p>