Ad
  • Custom User Avatar

    Your IDE is correct.
    The reason why it works in this case is because one of these return statements will be always executed.

    The condition 'name.toUpperCase().startsWith("R")' is either true or false. And you have one return statement for each of these possibilities. There is no condition that would lead elsewhere.