More than one BufferedReader
posted 1 year ago
To add some additional information, the reason the second read doesn't appear to work is because read() just reads the next character in the stream. So, if you enter a name with more than 1 letter eg Henry, the first call to read gets the first letter 'H'. When you call read again it doesn't wait for you to enter a roll number because there is still 'enry\n' in the input stream so it gets the 'e' and continues. If you enter a single letter name it still doesn't work because pressing the Enter key adds a '\n' char to the stream so the second read gets that. As Campbell has said use readline() or better still use a java.util.Scanner.