java bufferedreader has next code example
Example 1: bufferedreader java
import java.io.BufferedReader;
//
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println(reader.readLine());
Example 2: how to check if the file has remaining without reading from it java
Scanner scanner = new Scanner(new File("filename"));
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
// process the line
}