Question: what is the difference between == operator and equals() method of object class in java?
Answer: 1) use == to compare primitive e.g. boolean, int, char etc, while use equals() to compare objects in Java. 2) == return true if two reference are of same object. Result of equals() method depends on overridden implementation.