title: Looping over a txt file, finding numbers within a range and their average
body: <p>I'm new to java programming and using NetBeans IDE 8.0, I'm trying to write a code which loops over a txt file full of numbers (numbers.txt), finds all the numbers below 10, and all the numbers over 30, and then calculates the average of these numbers, and outputs in something like "The average of numbers in range is __"</p>
  
  <p>This is the code I've got so far, as I'm not quite sure where I've gone wrong:</p>
  
  <pre><code>public class RangeAverage {
  
  
  int average=0,num;
  Scanner scan=new Scanner(new File("numbers.txt"));
  while(scan.hasNextInt())
  {
      if((num=scan.nextInt()&lt;10 || num &gt;30)
      {
          average+=num;
      }
  }
  System.out.println(" Average of numbers in range is "+average);
  
  }
  </code></pre>
  
  <p>The errors I get are on the lines:</p>
  
  <pre><code>Scanner scan=new Scanner(new File("numbers.txt")); (Lightbulb symbol)
  -cannot find symbol
  symbol: class Scanner
  location: class RangeAverage
  
  -cannot find symbol
  symbol: class Scanner
  location: class RangeAverage
  
  -cannot find symbol
  symbol: class Scanner
  location: class RangeAverage
  -----------
  </code></pre>
  
  <p>and on the line </p>
  
  <pre><code>System.out.println(" Average of numbers in range is "+average); (a ! error)
  -cannot find symbol
  symbol: class out
  location: class System
  
  &lt;identifier&gt; expected
  
  illegal start of type
  -------------
  </code></pre>
  
  <p>Any help would be appreciated, thanks!</p>