Basic HTML version of Foils prepared Sept 21 1998

Foil 36 Standard Input/Output

From Java Tutorial 98- 4: Multi-Treading, Useful Java Classes, I/O and Networking NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken

Standard Input/Output for Foil 36
1 The System class in java.lang provides the "standard" IO streams System.in, System.out, and System.err.
2 System.in is an instance of InputStream.
3 System.out and System.err are instances of PrintStream.
4 PrintStream is a subclass of FilterOutputStream, which itself is a subclass of OutputStream.
5 PrintStream objects should not be instantiated; use other subclasses of FilterOutputStream for byte streams or PrintWriter objects for character streams.
6 PrintStream and PrintWriter define methods print(...) and println(...), which output any primitive type:
  • System.out.println( "Enter character: " );
  • int ch = System.in.read();
  • System.out.println( (char) ch );

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998