Worked example
public static void printFile(String fileName) throws IOException {
File f = new File(fileName); // 1. File from the name
Scanner in = new Scanner(f); // 2. Scanner from the File
while (in.hasNextLine()) { // 3. read until no more lines
System.out.println(in.nextLine());
}
in.close(); // 4. close when done
}
Remember it as Create File, Scanner from File, then loop — and close at the end. (Imports such as java.io.File and java.util.Scanner are provided; you do not write them on the exam.)