Guide to Object-oriented Programming With Java (Buffalo State University Version)
Chapter 12: Working With Files
File Input/Output (I/O)
Java provides many different ways to work with files.
Using java.io.util.Scanner
to Read a File
You can use the java.io.util.Scanner
library to read a file one line at a time.
Using java.io.util.BufferedReader
to Read a File
You can also use the java.io.util.BufferedReader
library to read a file one line at a time.
Using java.nio.file.Files
to Read a File
You can also use the java.nio.file.Files
library to read a file one line at a time. The "n" in nio
stands for "new".
Using System.out.format()
to Format Data
You can also use the System.out.format()
methods to format the data you want to display..
Let's get started with a File Read program!