0
Why is this line being skipped?
This isn’t running right in SoloLearn, but when I run this on my PC, everything executes except for the line answer = input.nextLine(); It ends on “Is that correct?” and doesn’t give me the option to input anything for answer. I’ve tried a couple different ways and can’t pin this one. Thank you! https://code.sololearn.com/cDrDFXsID8oE/?ref=app
4 Respuestas
+ 7
On SL playground, the compiler does a little different than on your IDE on pc.
You need to enter all the required values at the beginning (separated by a space or new line) and start the code.
+ 7
John Wells Thanks a lot, sir! 👍
Prophet0fLoss here we go! 😉
https://code.sololearn.com/coq2jPbggRoH/?ref=app
+ 5
It does read, but nextInt doesn't read the new line after the age so nextLine reads that one and not your answer. Any time you read with any next method other than nextLine you are left with the new line ending that line so should always follow it a nextLine call. However, a second nextInt will skip whitespace so will skip over the new line.
+ 1
Danijel Ivanović why on my PC does it not run the line before last that asks for answer input?