package devmanuals; import java.io.*; // Example of FileOutputStream public class FileOutStreamDemo { public static void main(String[] args) { FileOutputStream out; // declare a file output object PrintStream p; // declare a print stream object try { // Create a new file output stream // connected to "DevFile.txt" out = new FileOutputStream("DevFile.txt"); // Connect print stream to the output stream p = new PrintStream(out); p.println("The text shown here will write to a file after run"); System.out.println("The Text is written to DevFile.txt"); p.close(); } catch (Exception e) { System.err.println("Error writing to file"); } } }