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