I am trying to optimize and write the best code possible (as any developer is) and I have been racking my head trying to figure out if this particular method I am writing is bad code. For some reason in my head I find that having multiple return statements are bad as opposed to having just one. Yet I have nothing in solid writing stating this is bad. Please tell me if this is bad code or not
public boolean fooBar(int foo, int bar){
if(foo == 3) {
return true;
}
if(bar == 3) {
return true;
}
System.out.println("foo or bar is not equal to three");
return false;
}
I am not looking for simplification, I am just looking for general ideas on if this is bad code or not and if there are performance issues that could arise from doing this.