Text and Binary Files
Introduction
How is I/O Handled in Java?
A File object encapsulates the properties of a file or a path, but does not contain the methods for reading/writing data from/to a file. In order to perform I/O, you need to create objects using appropriate Java I/O classes.
Scanner input = new Scanner(new File("temp.txt")); System.out.println(input.nextLine());Formatter output = new Formatter("temp.txt"); output.format("%s", "Java 101"); output.close();