0

I have tow instances of this example class like this:

Class A
{

String m1;
String m2;
int m3;
}

and two objects

A obj1, obj2

I want to perform deep equality (non reference based, but content based).

Is there a way that java will do the deep equality without me to have to override equals(Object other) ?

Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
  • Read http://javatechniques.com/blog/string-equality-and-interning/ – Rakesh KR Jul 06 '14 at 10:07
  • 3
    No. You'll have to override equals() and hashCode() – JB Nizet Jul 06 '14 at 10:23
  • possible duplicate of [using equals method in same class without overriding](http://stackoverflow.com/questions/17320172/using-equals-method-in-same-class-without-overriding) – Raedwald Jul 06 '14 at 11:50
  • Possible duplicate of http://stackoverflow.com/questions/13134050/when-do-i-need-to-override-equals-and-hashcode-methods – Raedwald Jul 06 '14 at 12:03

0 Answers0