Java I/O


  • All modern I/O is stream-based
  • A stream is a connection to a source of data or to a destination for data (sometimes both)
  • An input stream may be associated with the keyboard
  • An input stream or an output stream may be associated with a file
  • Different streams have different characteristics:
  • A file has a definite length, and therefore an end
  • Keyboard input has no specific end

How to do I/O

  • import*;
  • Open the stream
  • Use the stream (read, write, or both)
  • Close the stream

File I/O Examples

Below is list of examples which can be user to handle files and their information.



Partner Sites