3.2.2.1 Standard Output3.2.2 Standard Input and Output3.2.2 Standard Input and Output3.2.2.2 Standard Input

3.2.2.1 Standard Output

The output streams System.out and System.err are of type PrintStream; System.out is the  standard output stream that is used for writing normal output, System.err is the  error output stream that is used for writing error messages. By default, both streams are mapped to the same output window but they can be also set up to write to different places.

The class PrintStream provides overloaded methods print and println for all primitive data types of Java including String and char[]:

   public class PrintStream
   {
      public void print(int x);
      public void println(int x);
      ...
   }

The class PrintStream provides byte streams; the characters written are converted to bytes using the underlying platform's default encoding (e.g. ISO 8859-1). It is mainly used for debugging and simple examples; to handle internationalization, the class PrintWriter is a better choice (see later).


© Wolfgang Schreiner; February 3, 2005

3.2.2.1 Standard Output3.2.2 Standard Input and Output3.2.2 Standard Input and Output3.2.2.2 Standard Input