What is equal and == in Java?

equals() Method in Java. Both equals() method and the == operator are used to compare two objects in Java. == is an operator and equals() is method . But == operator compares reference or memory location of objects in a heap, whether they point to the same location or not.

Sizin İçin Seçtik  Can a double be null in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *