title: How can I check that no letters are entered in the array?
body: <p>This is a simple calculator program. I just need something to check my array and prevent any letters being in it before my program continues "adding" the two arguments entered. The input is taken from the command line e.g. <code>java adder 1 2</code></p>
  
  <pre><code>public class Adder {
      public static void main(String[] args) {
          //Array to hold the two inputted numbers
          float[] num = new float[2];
          //Sum of the array [2] will be stored in answer
          float answer = 0;
  
          /*
              some how need to check the type of agruments entered...
          */
  
          //If more than two agruments are entered, the error message will be shown
          if (args.length &gt; 2 || args.length &lt; 2){
              System.out.println("ERROR: enter only two numbers not more not less");
          }
  
          else{
          //Loop to add all of the values in the array num 
              for (int i = 0; i &lt; args.length; i++){
                  num[i] = Float.parseFloat(args[i]);
                  //adding the values in the array and storing in answer
                  answer += Float.parseFloat(args[i]);
              }
  
              System.out.println(num[0]+" + "+num[1]+" = "+answer);
          }
      }
  }
  </code></pre>