Originally posted by Satou kurinosuke: No, it's about inheritance. Parent class and subclass.
You can compare A and B, but you cannot compare String and Integer.
One more thing, this will work...
EDIT: As per your subject line: question regarding using equals(). It looks like you are asking whether equals() will work or not when classes are not in the same hierarchy? Call to inherited equals() will work even if there is not inheritance relationship between the classes as discussed below.