Print Streams

The class is a subclass of FilterOutputStream. It is implemented by System.out and System.err. It allows very simple console output of both primitive values, objects, and string literals. It uses the platform's default character encoding to convert characters into bytes.

This class traps all IOExceptions. However you can test the error status with checkError(). This returns true if an error has occurred, false otherwise.

public boolean checkError()

The main use of the class is the exceptionally overloaded print() and println() methods. They differ in that println() adds an end-of-line character to whatever it prints while print() does not.

 public void print(boolean b)
 public void print(int i)
 public void print(long l)
 public void print(float f)
 public void print(double d)
 public void print(char[] text)
 public void print(String s)
 public void print(Object o)
 public void println()
 public void println(boolean b)
 public void println(char c)
 public void println(int i)
 public void println(long l)
 public void println(float f)
 public void println(double d)
 public void println(char[] text)
 public void println(String s)
 public void println(Object o)

PrintStream is primarily intended for debugging. Otherwise it's unofficially deprecated in Java 1.1. You should use the PrintWriter class instead.

Previous | Next | Top | Cafe au Lait

Copyright 1997, 2003 Elliotte Rusty Harold
Last Modified April 22, 2003