title: No output from a program that compiles
body: <p>I can't wrap my head around why I get zero output... The code looks correct to me, and it compiles with no problem (except for the lack of output). I have tried with absolute path. The text file is stored in the same folder as the class. Am I missing something obvious?</p>
  <pre class="lang-java prettyprint-override"><code>public class File {
  
      public static void main(String[] args) throws FileNotFoundException {
          String filename = &quot;./inputD2.txt&quot;;
          readFile(filename);
          System.out.println( readFile(filename));
      }
      private static List&lt;String&gt; readFile(String filename) {
          List&lt;String&gt; records = new ArrayList&lt;&gt;();
          try {
              BufferedReader reader = new BufferedReader(new FileReader(filename));
              String line;
              while ((line = reader.readLine()) != null) {
                  records.add(line);
              }
              reader.close();
              return records;
          }
          catch (Exception e) {
              System.err.format(&quot;Exception occurred trying to read '%s'.&quot;, filename);
              e.printStackTrace();
              return null;
          }
      }
  }
  </code></pre>