title: Good practice in Java File I/O
body: <p>I am trying to read integers from a file, apply some operation on them and writing those resulting integers to another file.  </p>
  
  <pre><code>// Input
  FileReader fr = new FileReader("test.txt");
  BufferedReader br = new BufferedReader(fr);
  Scanner s = new Scanner(br);
  
  // Output
  FileWriter fw = new FileWriter("out.txt");
  BufferedWriter bw = new BufferedWriter(fw);
  PrintWriter pw = new PrintWriter(bw);
  
  int i;
  
  while(s.hasNextInt())
  {
      i = s.nextInt();
      pw.println(i+5);
  }
  </code></pre>
  
  <p>I want to ask is it a good practice to wrap these input and output streams like this?<br>
  I am new to java and on internet, I saw lots of other ways of I/O in files. I want to stick to one approach so is above the best approach ?</p>