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