Domanda di colloquio di CodeGen International

What is the difference between == and .equals() in Java when comparing two objects?

Risposta di colloquio

Anonimo

11 gen 2024

== checks if two things are exactly the same, like comparing two identical toys. .equals() checks if two things are similar, like comparing two toys that may look a bit different but serve the same purpose.