how to exit a function in java code example
Example 1: how to exit a java program
System.exit(0);
Example 2: how to interrupt a void java
public void someMethod() {
//... a bunch of code ...
if (someCondition()) {
return; //This exits the method
}
//... otherwise do the following...
}
Example 3: break a function java
public void someMethod() {
//... a bunch of code ...
if (someCondition()) {
return; //break the funtion
}
//... otherwise do the following...
}