Input and output streams communicate between programs that are running in separate processes.
The java.lang.Runtime.exec() method runs a program. The parent program can get handles to the child process input and output streams and can write to or read from those streams. If the child program is written in a language other than Java™, you must ensure that any American Standard Code for Information Interchange (ASCII) or extended binary-coded decimal interchange code (EBCDIC) conversion takes place. See Java character encodings for more details.
For an example that uses input and output streams, see Example: Use input and output streams for interprocess communication.