title: how to read last line in a text file using java
body: <p>I am making a log and I want to read the last line of the log.txt file, but I'm having trouble getting the BufferedReader to stop once the last line is read.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>try {
      String sCurrentLine;
  
      br = new BufferedReader(new FileReader("C:\\testing.txt"));
  
      while ((sCurrentLine = br.readLine()) != null) {
          System.out.println(sCurrentLine);
      }
  } catch (IOException e) {
      e.printStackTrace();
  } finally {
      try {
          if (br != null)br.close();
      } catch (IOException ex) {
          ex.printStackTrace();
      }
  }
  </code></pre>