0
Java, any idea why this code doesn't work?!
I coded it on Netbeans, but when copied into SL, it doesn't run properly. As far as i can see, the Scanner doesn't work properly. Well, my first try to code smth in Java. Thanks for your advice.... https://code.sololearn.com/cr9rxfcdwSgQ/#java
6 Answers
+ 2
"is it possible to make a break in the text output instead of writing two separate lines?!" - Sure just use "\n" in the string
Your program doesnt work because you are asking for alot of user input, everytime your while loop repeats it expects another input. In a normal java application this would work as the program would sinply continue to ask for another input. In Code playground you need to enter ALL inputs before executing
+ 6
you only need to create one instance of scanner and use " \n " to create a new line.
+ 1
one suggestion
no need to define the scanner statement again and again.
+ 1
@wenz multiple inputs in code playground are achieved by writing each input in a new line but since you dont know how many inputs are needed thats not an option. Dummy inputs are the only way to go here (maybe an array with different values that are used randomly)
0
@Jeremy Aaaahhh.... I think I got it. ... basically we would need to 'simulate' the user input by dummy variables/values in order to make it run in SL. ... but it's not possible in SL to let a code run like this (many user inputs)?! Right?
thx... I'm in the very very beginning...
0
@Jeremy perfect! got it :)