Code not running properly - Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Code not running properly - Java

Would you guys help me? Could anyone tell me why this code isn't working properly? https://code.sololearn.com/cjEoeRi2LOm6 When it's run the following error shows up: Enter first number: Enter Second number: Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextDouble(Unknown Source) at apples.main(apples.java:10) I couldn't figure it out

17th Jan 2018, 9:05 PM
Eddyn Gonzalez
Eddyn Gonzalez - avatar
2 Answers
+ 6
For Java on Code Playground you have to input everything at once when prompted. Try putting numbers into the input box like this: 5 9.5 Answer will be 14.5. Which is correct.
17th Jan 2018, 9:15 PM
Rrestoring faith
Rrestoring faith - avatar
+ 4
It's working fine!
17th Jan 2018, 8:51 PM
Harjeet Singh
Harjeet Singh - avatar