Q:

Java FileWriter() vs createNewFile()?

is there an advantage to using the FileWriter() class & constructor instead of the createNewFile() method in the File class?
I can't figure out the difference or the advantage. createNewFile() seems simpler and more intuitive so I'm thinking of abandoning my use of the FileWriter but I wanted to check. 
Thanks.

A:

File.createNewFile() creates only an empty file.  A FileWriter additionally allows you to write character-based data out to a file.
Use the most direct and obvious method available.  If you want an empty new file, the former will work fine.  Anything more complicated will usually involve a Writer or OutputStream of some kind.

