posted 21 years ago
If you want to compare the addresses in memory of two object references, use ==
If you want to compare the state of two objects, use equals() (except when using equals() of Object class, which behaves like ==. Any other class which does not override this also inherits the same behavior for equals()).