We use the predefined object System.out of the class PrintStream (subclass of OutputStream).
OutputStream os = System.out;
We create an object of the class FileOutputStream (subclass ofOutputStream) associated to the File object that identifies the file to open for writing.
FileOutputStream os = new FileOutputStream("data.txt");
Note: It is not possible to write to an Internet resource by simply using an output stream.