Interview Detail

What is the difference between == and equals()?

Core Java · Intermediate

Short Answer

For objects, == compares references while equals() is intended for logical equality. Also discuss hashCode.