title: checking if scanner input as positive integer
body: <p>I know there are a lot of questions already on the website about this issue but i still cant get the hang of it in my program. </p>
  
  <pre><code>import java.util.Scanner;
  public class time {
  public static void main (String[] args) {
      int a, sec, min, hour;
  
      System.out.println ("Please enter the number of seconds");
      Scanner user_input = new Scanner (System.in);
      a = user_input.nextInt();
  
      while (!user_input.hasNextInt()) {
          System.out.println ("Error: INVALID INPUT, please try again");
          System.out.println("Please enter the number of seconds");
          a = user_input.nextInt();
      }
  
      hour = a/3600;
      min = ((a%3600)/60);
      sec = ((a%3600)%60);
  
      System.out.println(hour + " hours "+ min+ " minutes " + sec + " seconds");
  
  }
  }
  </code></pre>
  
  <p>so the above is my program. 
  I am just starting to learn JAVA so I tried my best but every time i run this program, it gives me nothing.</p>
  
  <p>I input a number and nothing comes up but the program is still running. </p>
  
  <p>The strange thing is.. when I change the </p>
  
  <pre><code>!user_input.hasNextInt() 
  </code></pre>
  
  <p>with a&lt;0, it works but that isn't good enough for me because it cant check for double inputs nor empty inputs.</p>