This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The File class is just a representation of a pathname or filename in the file system. It doesn't have anything to do with the contents of the file.
Your second piece of code will not compile, because class java.io.DataOutputStream does not have a constructor that takes a java.io.File as the argument. You could have discovered that quickly by writing a small program yourself.