return in if java code example
Example 1: java return if
public void test(){
if(something){
return;//this ends the method
}
//do whatever you want
}
Example 2: return statement in java
A return statement causes the program control to transfer back to the caller of a method.