[Solved] How to stop the run of the program in java? [duplicate]


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.

solved How to stop the run of the program in java? [duplicate]