you type a letter "y", and then you type a line return

read() just reads one character ("y")

the line return is still in the stream

then when readLine() is called, it reads until it encounters a line return, which is the first character it encounters

so it returns an empty line

Integer.parseInt() cannot parse an empty string