how to terminate a program in java code example
Example 1: how to exit a java program
System.exit(0);
Example 2: java how to exit loop
//how to exit loop in java
while (true) {
if (obj == null) {
break;
}
}
System.exit(0);
//how to exit loop in java
while (true) {
if (obj == null) {
break;
}
}