How do I tell if an empty line has been read in with a BufferedReader?
问题 I'm reading in a text file formated like word definiton word definition definition word definition So I need to keep try of whether I'm in a definition or not based on when I reach those emtpy lines. Thing is, BufferedReader discards \n characters, and somehow comparing that empty line to String "" is not registering like I thought it would. How can I go about doing this. 回答1: Make sure you use: myString.equals("") not myString == "" . After 1.6, you can use myString.isEmpty() You can use