+ 3
How to restart programm in java [SLOVED]
I want to restart my code if user input Ok, how can I do this? (I knows about scanners)
6 odpowiedzi
0
For simple code I suggest using a loop.
break out of it when user inputs "Ok" or use System.exit(0)
+ 3
Only you can get the answer. Because that anwser depends on the code itself. Also the value that need to be changed, to allow the code to repeat its cycle.
0
Mirielle🐶
case should be lowercase
switch is used for input rather than condition so it may be a bit misleading
third, I don't think a method is needed - a block of code can be executed using while(true)