Java maintenance and ecosystem
Original exception and resource exercise
The third read reaches EOF; try-with-resources closes the reader. No external file is required.
Formal Syntax & Structure
java syntaxjava
BufferedReader.readLine()Working Example
Example Snippetjava
public class Main { public static void main(String[] args) throws Exception { try(var r=new java.io.BufferedReader(new java.io.StringReader("pen\nbook\n"))) { System.out.println(r.readLine()); System.out.println(r.readLine()); System.out.println(r.readLine()==null); } }}