title: How to ensure certain requirements are met in my Java Program
body: <pre><code>public class FileAddClient {
  
    public static void main(String[] args) throws FileNotFoundException {
      Scanner scanfile = new Scanner(System.in);
  
      System.out.println(&quot;What is the exact name of your file?&quot;);
      String doc = scanfile.next();
  
      Scanner scanint = new Scanner(new File(doc));
  
      int number1 = scanint.nextInt(), number2 = scanint.nextInt(),
      number3 = scanint.nextInt(), number4 = scanint.nextInt(),
      number5 = scanint.nextInt(), number6 = scanint.nextInt();
  
      int sum = number1 + number2 + number3 + number4 + number5 + number6; 
  
      System.out.println(&quot;The sum of the numbers that typed is &quot; + sum);
  
    }
  
  }
  </code></pre>
  <p>How can I ensure that the user enters at least 2 numbers into the file and that the only data types in the file are numbers? I am not sure how to navigate through this problem. I tried making a while loop, but, unfortunately, that is not working. Any help would be appreciated.</p>