how to exit from while loop in java code example
Example 1: break a function java
public void someMethod() {
//... a bunch of code ...
if (someCondition()) {
return; //break the funtion
}
//... otherwise do the following...
}
Example 2: java how to exit loop
//how to exit loop in java
while (true) {
if (obj == null) {
break;
}
}