title: Throwing exception for wrong data types?
body: <p>in the case that I want to throw an exception when the wrong type of data type is entered, how can I do this with IllegalArgumentException? </p>
  
  <pre><code>if(row &lt; 1) {
          row = 1;
      }
      if(row &gt; 5) {
          row = 5;
      }
      if (row != int) {
          throw new IllegalArgumentException("Please enter appropriate integer.");
      }
      System.out.print("Specify red value (0-255): ");
      int red = console.nextInt();
      if(red &lt; 0) {
          red = 0;
      }
      if(red &gt; 255) {
          red = 255;
      }
      if (red != int){
          throw new IllegalArgumentException("Please enter appropriate integer.");
      }
      System.out.print("Specify green value (0-255): ");
      int green = console.nextInt();
      if(green &lt; 0) {
          green = 0;
      } 
      if(green &gt; 255) {
          green = 255;
      }
      if (green != int){
          throw new IllegalArgumentException("Please enter appropriate integer.");
      }
      System.out.print("Specify blue value (0-255): ");
      int blue = console.nextInt();
      if(blue &lt; 0) {
          blue = 0;
      }
      if(blue &gt; 255) {
          blue = 255;
      } 
      if (green != int){
          throw new IllegalArgumentException("Please enter appropriate integer.");
      }
  </code></pre>
  
  <p>My main problem is with the "!= int" part. I know for a fact that this is not right, but I am not sure what else to use. Using an else statement will not work either. If someone were to enter a double, string, or boolean input into the scanner instead of an integer, how could I throw an exception for this? I have to do this for an assignment, and they specifically said that I need to use a throw exception for this. Thanks everyone in advance!</p>