title: Java - how to read from file when I used PrintWriter, BufferedWriter and FileWriter to write?
body: <p>I have method which writes some data to file. I use <code>PrintWriter</code>, <code>BufferedWriter</code> and <code>FileWriter</code> as shown below</p>
  
  <pre><code>public void writeToFile(String FileName){
      PrintWriter pw = null;
      try {
          pw = new PrintWriter(new BufferedWriter(new FileWriter(FileName)));
          for(Cars car : list){
              pw.println(car.getType());
              pw.println(car.getMaxSpeed());
              pw.println(car.getOwner());
              pw.println();
              pw.flush();
          }
          pw.close();
      }
      catch(IOException ex){
          System.err.println(ex);
      }
  }
  </code></pre>
  
  <p>Now how can I read this data from file? I tried to use <code>InputStreamReader</code>, <code>BufferedReader</code> and <code>FileInputStream</code>, but my NetBeans shows me an error message</p>
  
  <pre><code>    public void readFromFile() throws IOException {
          InputStreamReader fr = null;
          try {
              fr = new InputStreamReader(new BufferedReader(new FileInputStream(new FileReader("c:\\cars.txt"))));
              System.out.println(fr.read());
          } catch (Exception ex) {
              System.out.println(ex.getMessage());
          } finally {
              fr.close();
          }
      }  
  </code></pre>
  
  <p>What is wrong with this method?</p>