title: OutputStreamWriter vs FileWriter
body: <p>I don't understand the difference between these two classes. When would you use one over the one? I know that FileWriter can output characters to a file but so can OutputStreamWriter as far as i know. Here is some code that i tested and they seem to work the same, i'm not adding the exception handling stuff but lets just assume its there.</p>
  
  <pre><code>FileWriter writer = new FileWriter("C:\\Users\\owner\\Desktop\\demo.txt");
  writer.write("hello");
  writer.close();
  </code></pre>
  
  <p>I also tried this code:</p>
  
  <pre><code>File file = new File("C:\\Users\\owner\\Desktop\\demo.txt");
  os = new OutputStreamWriter(new FileOutputStream(file));
  os.write("hello");
  os.close();
  </code></pre>
  
  <p>Both of these seem to work the same for me. The only time something strange happens is when i try to put an int value in the write() method. For the FileWriter example, my demo.txt is completely empty. For the OutputStreamWriter example i get some weird symbols in my text file. I am reading a java book and the only explanation i get for OutputStreamWriter is that it "converts a stream of characters to a stream of bytes" so shouldn't i be seeing some bytes in my text file in the second example?</p>
  
  <p>Some clarification would be greatly appreciated.</p>