return true
is only executed if the if
condition is true. For all other cases you need the return false
More Related Contents:
- Does a finally block always get executed in Java?
- What issues should be considered when overriding equals and hashCode in Java?
- Why do I need to override the equals and hashCode methods in Java?
- Compare two objects with .equals() and == operator
- “Missing return statement” within if / for / while
- What’s the difference between “.equals” and “==”? [duplicate]
- Returning from a finally block in Java
- Any reason to prefer getClass() over instanceof when generating .equals()?
- Multiple returns: Which one sets the final return value?
- Java: Ternary with no return. (For method calling)
- How to override equals method in Java
- Getting an element from a Set
- How to check if my string is equal to null?
- Using == operator in Java to compare wrapper objects
- Try-catch-finally-return clarification [duplicate]
- Is there a Java utility to do a deep comparison of two objects? [closed]
- compareTo() vs. equals()
- comparing arrays in java
- Hashcode and Equals for Hashset [duplicate]
- Why is return needed even after System.exit(0);
- what is the difference between == operator and equals()? (with hashcode() ???)
- Try-with-resources and return statements in java
- What does comparison being consistent with equals mean ? What can possibly happen if my class doesn’t follow this principle?
- How to implement hashCode and equals method
- Can someone explain a void return type in Java?
- Why can’t we use ‘==’ to compare two float or double numbers [duplicate]
- Java interfaces and return types
- Why are two AtomicIntegers never equal?
- Return different type of data from a method in java?
- When “” == s is false but “”.equals( s ) is true