title: Creating an exception without conditions?
body: <p>I have to create a program in which I input 2 values simultaneously but, these values must range from 50 to 127. If the value is less than 50 or above 127 it should show an exception saying &quot;value entered&quot; is too low or too high. As a requirement for the program, I cannot use flow-control statements. I have not tried anything as I am lost
  UPDATE: WITH THE HELP OF YOUR COMMENTS I HAVE SATISFIED THE 127 CONDITION, AND MAY BE ON THE WAY TO SATISFYING THE LOWER CONDITION WITH THE NEXT(PATTERN) METHOD. I AM CURRENTLY CONTACTING MY TEACHER AND ASKING IF SATISFYING THE 127 CONDITION IS ENOUGH. THANK YOU ALL</p>
  <p>UPDATE 2: the 127 condition was enough!</p>
  <pre><code>import java.util.Scanner;
  
  public class A1_Q1 {
  
      public static void main(String[] args) {
          // declaration of variables
          double x, y, z;
          int p, q;
          Scanner kBoard = new Scanner(System.in);
  
          System.out.println(&quot;Welcome to the Simple 3D-Space Program:&quot;);
          System.out.println(&quot;+++++++++++++++++++++++++++++++++++++++&quot;);
          System.out.print(&quot;Enter values for 'p' and 'q' simultaneously. Must be between 50 and 127:&quot;);
  
          String input = kBoard.nextLine();
  
  //separating first number and second number from the inputed line
          String firstNum = input.substring(0, input.indexOf(&quot; &quot;));
          String secondNum = input.substring(input.indexOf(&quot; &quot;), input.length());
  
  //isolating numbers from the strings and filtering out
          String numOnlyP = firstNum.replaceAll(&quot;[^0-9]&quot;, &quot;&quot;);
          String numOnlyQ = secondNum.replaceAll(&quot;[^0-9]&quot;, &quot;&quot;);
  
  //transforming string into integer values
          p = Integer.parseInt(numOnlyP);
          q = Integer.parseInt(numOnlyQ);
  
  //to check and see if previous code was functioning correctly
          System.out.println(p + &quot; &quot; + q);
      }
  
  }
  </code></pre>