<<< DataOutputStream: opening binary file for appending     Index     DataOutputStream implements DataOutput interface >>>

8. Console output: writing byte array using OutputStream


  • 
    import java.io.*;
    public class ScreenOutput
    {
        public static void main(String[] args)
        {
            String s = "ABCDF";
            byte[] data = s.getBytes();
            OutputStream output = null;
            try
            {
                output = System.out;
                output.write(data);
                output.flush();
                output.close();
            }
            catch(Exception e)
            {
                System.out.println("Message: " + e);
            }
        }
    }//class ScreenOutput
    
    
  •   PrintStream and PrintWriter


<<< DataOutputStream: opening binary file for appending     Index     DataOutputStream implements DataOutput interface >>>