try { BufferedReader reader = new BufferedReader(new FileReader("filename.txt")); String line; while ((line = reader.readLine()) != null) { System.out.println(line); } reader.close(); } catch (IOException e) { e.printStackTrace(); }In this example, we create a new BufferedReader and pass it a FileReader object that points to a file named "filename.txt". The `readLine()` method is called on the BufferedReader object within a loop to read each line from the file until there are no more lines left to read. The code then prints out each line as it is read. Finally, the reader is closed to release any system resources it may have held. The BufferedReader class is part of the java.io package library, which provides classes for performing input and output operations in Java.