title: Counting the number of lines in a file
body: <p>I am trying to develop a program in java that will count the number of files in a given folder along with the lines of code in each individual file. I currently have code that will only pick up a single file from the folder and count the lines of code for that particular file. Please help me understand how to proceed from here.</p>
  
  <p>My current code:</p>
  
  <pre><code>public class FileCountLine {
  
      public static void main(String[] args) throws FileNotFoundException {
  
          File file = new File("E:/WalgreensRewardsPosLogSupport.java"); 
          Scanner scanner = new Scanner(file);    
          int count = 0;               
          while (scanner.hasNextLine()) { 
              String line = scanner.nextLine();   
          count++;              
          }           
          System.out.println("Lines in the file: " + count);
  
      }
  
  } 
  </code></pre>