Question: what is the difference between the equals method and the == operator in java?
Answer: Both equals() method and the == operator is used to compare two objects in Java. == is an operator and equals() is method. But == operator compares reference or memory location of objects in the heap, whether they point to the same location or not.