The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.
See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.
This lesson covers the Java platform classes used for basic I/O. It first focuses on I/O Streams, a powerful concept that greatly simplifies I/O operations. The lesson also looks at serialization, which lets a program write whole objects out to streams and read them back again. Then the lesson looks at file I/O and file system operations, including random access files.
Most of the classes covered in the I/O Streams
section are in the java.io
package. Most of the classes covered in the File I/O
section are in the java.nio.file
package.
String
values.java.nio.file
package.Path
class that deal with syntactic operations.Path
functionality if you have older code using the java.io.File
class. A table mapping java.io.File
API to java.nio.file
API is provided.A summary of the key points covered in this trail.
Test what you've learned in this trail by trying these questions and exercises.
Many of the examples in the next trail, Custom Networking use the I/O streams described in this lesson to read from and write to network connections.