title: How can I end a program during a try catch statement in Java?
body: <p>I already asked a question about how to have a message pop up and say "please enter a number input" but it was supposed to end the program. Not crash it, but end the program then you would have to rerun it. </p>
  
  <pre><code>`    try 
   {
       number = in.nextInt();
  
         if(number &gt;= 8) 
         { 
         number = 8; 
         }
         else if (number &lt;= 0)
         {
         number = 0;
         }
     } 
     catch (InputMismatchException exc) 
  
     {
         System.out.println("Program requires NUMBER input");
  
     }
  </code></pre>
  
  <p>`</p>
  
  <p>I tried doing a "break;" in the catch (experimented I guess) and it didn't work.</p>
  
  <hr>
  
  <p>UPDATE: Thanks everyone, I tried return in a previous project and it didn't work. But it worked here so thank you again!! </p>