Java Tutorial · Revision notes

Java I/O & File Handling

Java I/O moves data between your program and files, the console or the network using streams. This chapter covers file handling, byte streams vs character streams, buffered readers/writers and object serialization.

Quick revision

  • File = path + metadata; use streams or Files for content
  • Byte streams: InputStream/OutputStream; character: Reader/Writer
  • Buffered classes batch I/O; readLine() null = EOF; close() flushes
  • FileWriter(f, true) appends; always use try-with-resources
  • Serializable marker; transient/static skipped; declare serialVersionUID
  • Deserialization does not call the class constructor
Read the full Java I/O & File Handling notes on Doubtclip →