public class TestReadFile { public void readFile(String fName) throws IOException { /* Line n1*/ Stream content = Files.lines(p); content.forEach(s1 -> System.out.println(s1)); } public static void main(String[] args) throws IOException { TestReadFile trf = new TestReadFile(); trf.readFile("TestResult.txt "); } }