I ran the following example:
public static void main(String[] args) throws IOException{
Reader reader = new BufferedReader(new InputStreamReader(System.in));
int character;
do{
character = reader.read();
System.out.println(character);
} while(character != '\n');
}
and was actually confused by the behaviour. I thought the default buffer size of the BufferedReader is large enough to hold more than 1 character.
But, when I entered
a__NEW_LINE__
it causes the character to be printed along with new line. Why? I expected that the buffer is not full, therefore there should be no output.