+ 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)

15th Jan 2020, 7:02 PM
FerutiiA1t
FerutiiA1t - avatar
6 odpowiedzi
0
For simple code I suggest using a loop. break out of it when user inputs "Ok" or use System.exit(0)
15th Jan 2020, 9:12 PM
HNNX 🐿
HNNX 🐿 - avatar
+ 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.
15th Jan 2020, 7:46 PM
Manual
Manual - avatar
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)
15th Jan 2020, 9:55 PM
HNNX 🐿
HNNX 🐿 - avatar