title: How do I add a loop to this program and have it keep running until program is true?
body: <p>How and where do I add a loop to this program so that the program keeps executing then ends once the user has enter a valid number between 100 and 999?    </p>
  
  <pre><code>import java.util.*;
  
  public class numLoop{
  public static void main(String[] arg){
    Scanner sc = new Scanner(System.in);
    int number = 0;
  
    try{
       Scanner reader = new Scanner(System.in);
       System.out.print("Enter a number between 100 and 999: ");
       number = reader.nextInt();
  
       if(number &gt; 999 || number &lt; 100)
          System.out.println("\nYour number was invalid.");
  
       else
          System.out.println("\nThe number " + number + " was vaild.");
  
        }
        catch(InputMismatchException ime){
              System.out.println("You didn't enter a number.");
  
       }
   }
  }
  </code></pre>