1// this is called "try-with-resources" statement in java 8.
2// it ensures that the resources are closed at the end.
3
4try (BufferedReader br = new BufferedReader(new FileReader(textFile))) {
5 String text = br.readLine(); // first line only
6 System.out.println(text);
7}