Q:

Can .equals be overridden such that a.equals(a) returns false?

I'm still pretty fresh to all this, but I'm working on attaining my OCAJP certification (Java).  I remembered reading previously that the .equals method could be overridden when I came to this question:

Now these questions have been pretty evil as far as I'm concerned.  Twisting every little thing you think you know to force you to learn all the minutiae.  Now I had guessed E, but I didn't think D was correct.  I mean 99.9% of the time, of course, but I thought it was a trick question based on the wording.
This got me thinking, is that true?  I mean, if I get the question on the exam, I know how to answer it now, but in the deep dark abyss of overriding madness, is it possible to create a situation where a.equals(a) returns false?  I feel like this would make Aristotle angry...

A:

Note that a. b and c are instances of primitive wrapper classes (such as Integer, Double, etc...). These classes are final and cannot be extended, so you can't override their equals implementation. 
Therefore a.equals(a) will always return true, since those classes implement equals properly.

A:

Since equals(...) is not a final method of Object, yes, it is very well be possible in a different situation.
@Override
public boolean equals(Object obj) {
    return false;
}

This question, however, specifically says that these are primitive wrappers (e.g. Integer, Boolean, etc.) and since these classes are final, you cannot extend them, thus a.equals(a) will always return true.

A:

Integer a.equals( a ) can return false
But you have to be really evil and use reflections and Multithreading:
If you run this code, there is a chance that a racing condition can change the internal Value of myInt while the comparision takes place. If you want to simulate this condition, just set a breakpoint inside of Integer.intValue() run the code in debug and hit continue. This will create a delay which creates the race condition artificially and the console will return false.
class IntegerEqualsTest
{
    public static void main( final String[] args )
    {
        final Integer myInt = new Integer( 420 );

        new Thread() {
            public void run() {
                try {
                    final Field f = Integer.class.getDeclaredField( "value" );
                    f.setAccessible( true );
                    f.setInt( myInt, 100 );
                } catch( final Exception e ) {}
            }; }.start();

        System.out.println( myInt.equals( myInt ) );
    }
}

