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 Answers
+ 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?