Q:

Correcting Input File to read each line

I am currently writing a recursive descent parser. The codes objective is to tell if a string is in the language. I need to read a file with multiple strings (one string each line). Currently it works just for the first string within the file and then writes to the console.. I am having an issue with correctly executing this, and making it read EACH line instead of the first. Any help appreciated. (there may be different methods of approaching this, as in rewriting alot of the code to be more sufficient.. but im just looking for the 'simple' solution as of right now)
top section of code where issue is located:
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Main
{
   static int ptr;
   static char[] input;
   public static void main(String[] args)
   {
       String str="";
       BufferedReader br = null;
       FileReader fr = null;
       try {

           fr = new FileReader("input.txt");
           br = new BufferedReader(fr);
           br = new BufferedReader(new FileReader("input.txt"));
           str = br.readLine(); 
          }
       catch (IOException e)
       {
           e.printStackTrace();
       }
       input = str.toCharArray();
       if(input.length < 2)
       {
           System.out.println("The string '"+str+"' is not in the language.");
           System.exit(0);
       }
       ptr = 0;
       boolean isValid = E();
       if((isValid) & (ptr == input.length))
       {
           System.out.println("The string '"+str+"' is in the language.");
       }
       else
       {
           System.out.println("The string '"+str+"' is not in the language.");
       }
   }

   static boolean E()
   {
       int fallback = ptr;
       if(input[ptr++] != '|')
       {
           ptr = fallback;
           return false;
       }
       if(P() == false)
       {
           ptr = fallback;
           return false;
       }
       if(O() == false)
       {
           ptr = fallback;
           return false;
       }

       return true;
   }

A:

If you can use java8 then Why not use java nio to read all lines? https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#readAllLines-java.nio.file.Path-java.nio.charset.Charset-

