title: Cant find the fix for my program at LeetCode Challenge of PrimeNumbers
body: <p>I have tried several ways changing my code in LeetCode but I can't find the fix,  the challenge is the next one :</p>
  <p>&lt;&lt;Count the number of prime numbers less than a non-negative number, n.</p>
  <p>Example:</p>
  <p>Input: 10
  Output: 4
  Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7.&gt;&gt;</p>
  <p>My proposal code is the next one:</p>
  <pre><code> import java.util.Scanner;
      class Solution {
          public int countPrimes(int n) {
          Scanner sc = new Scanner(System.in);
          int sum = 0;
          int cont = 0;
          int prime = 0;
          prime = sc.nextInt();
          int a[] = new int [prime];
          for(int i = 0; i &lt; a.length; i++) {
              a[i] = i;
              cont = 0;
              
              for(int y = 1; y&lt; a.length; y++) {
                  if(a[i] % y == 0) {
                      cont ++;
                  }
              }
              if (cont == 2) {
                  sum ++;
              }
          }
          return sum;
      }
  }
  </code></pre>
  <p>Meanwhile the error marks as follows:</p>
  <pre><code>Submission Result: Compile Error More Details 
  Line 7: error: cannot find symbol [in __Driver__.java] int ret = new Solution().countPrimes(param_1); ^ symbol: method countPrimes(int) location: class Solution
  Run Code Status: Runtime Error
  ×
  Run Code Result:
  Your input
  10
  Your answer
  java.util.NoSuchElementException
    at line 937, java.base/java.util.Scanner.throwFor
    at line 1594, java.base/java.util.Scanner.next
    at line 2258, java.base/java.util.Scanner.nextInt
    at line 2212, java.base/java.util.Scanner.nextInt
    at line 8, Solution.countPrimes
    at line 54, __DriverSolution__.__helper__
    at line 84, __Driver__.main
  Show Diff
  Runtime: N/A
  </code></pre>
  <p>Please help!</p>