CodeGen International Interview Question

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

Interview Answer

Anonymous

Jan 11, 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.