call the method from another part of your code and use the returned value. Here's an example:
xxxxxxxxxx
public class Main {
public static void main(String[] args) {
int result = addNumbers(3, 4);
System.out.println(result);
}
public static int addNumbers(int a, int b) {
int sum = a + b;
return sum;
}
}
xxxxxxxxxx
public void test(){
if(something){
return;//this ends the method
}
//do whatever you want
}
xxxxxxxxxx
boolean response = false;
if(total == 0) {
response = true;
}
return response;