I have created a program that will scan a text file, switch certain characters, and print into another file. I created a program that changed "|" to "\t" AND "\n" to "". There is a run-time error saying, "Exception in thread "main" java.lang.NullPointerException at Nov5.main(Nov5.java:20)"
If anyone knows how to correct this error and get my program running, that would be great. Thanks so much!
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.BufferedWriter;
public class Nov5  
{
public static void main( String args[] )
{
    try
    {
        BufferedReader br = new BufferedReader(new FileReader( "OneRecord.fna" ));
        BufferedWriter bw = new BufferedWriter(new FileWriter( "OneLineRecord.faa" ));
        String line;
        { 
            while ((line = br.readLine () ) != null)
            line = line.replace ( '|' , '\t');
            String replacedString = line.replaceAll ("(\\n)", "");
            bw.write( line );
        }
        br.close();
        bw.close();
    }
    catch( IOException e )
    {
        System.out.println( "error" );
    }
}
}
 
     
     
    