title: How to Stop Looping when the input is null (for int) Java
body: <p>i just made my own program for stop loop when the input is <code>null</code>, but this program can only succeed with String.</p>
  
  <pre><code>Scanner scan = new Scanner(System.in);
  String name = " ";
  while(true) {
      name = scan.nextLine();
      if(name.equals("")) {
         break;
      }
  }
  </code></pre>
  
  <p>so, if you didn't put anything on the <code>String name</code> you just click enter on your keyboard than the loop gonna be stop.</p>
  
  <p>but when you try to change the String to int, there is one problem that you will get.</p>
  
  <pre><code>Scanner scan = new Scanner(System.in);
  int name = " ";
  while(true) {
      name = Integer.parseInt(scan.nextLine());
      if(name....) {
         break;
      }
  }
  </code></pre>
  
  <p>what must be fill in <code>if</code> ?</p>