I am reading lines from a file using BufferedReader
. The code with the issue is:
while((line.charAt(0)!='X') && (line !=null))
This gives a `NullPointerException when it reaches the last line. However:
while(line !=null)
alone works perfectly i.e. BufferedReader
doesn't catch an exception. So, the problem seems to be when implementing multiple conditions with a BufferedReader
condition.