since your method signature says that method should return boolean so as soon as your method encounters a return method it's task is completed and it returns true and exit form method however if you remove first return statement you will get what you expect