i want get input user, if it was a bigger than 10 , stop run program
So far, i have this:
int value=sc.nextInt();
if (value>10){
**Stop running**
}
i want get input user, if it was a bigger than 10 , stop run program
So far, i have this:
int value=sc.nextInt();
if (value>10){
**Stop running**
}
You just stop the program by adding the line System.exit(0);
, like
int value=sc.nextInt();
if (value>10){
System.exit(0);
}
This terminates the running JVM and — of course — the program running on it.