title: counting the number of lines in a text file (java)
body: <p>Below is how i count the number of lines in a text file. Just wondering is there any other methods of doing this? </p>
  
  <pre><code>while(inputFile.hasNext()) {    
      a++;
      inputFile.nextLine();
  }
  inputFile.close();
  </code></pre>
  
  <p>I'm trying to input data into an array, i don't want to read the text file twice.</p>
  
  <p>any help/suggestions is appreciated.</p>
  
  <p>thanks</p>