Here you can find the source of equals(Object o1, Object o2)
equals()
.
public static final boolean equals(Object o1, Object o2)
//package com.java2s; public class Main { /**/*from w w w. java 2 s. c o m*/ * Tests if specified objects are equal using <code>equals()</code>. * Unlike with <code>equals()</code>, both objects may be * <code>null</code> and two <code>null</code> objects are always * considered to be equal. * <p>This function is missing in java.util.Arrays which, on the other * hand, has all the other functions: <code>Arrays.equals(boolean[], * boolean[])</code>, <code>Arrays.equals(byte[], byte[])</code>, ..., * <code>Arrays.equals(Object[], Object[])</code>. */ public static final boolean equals(Object o1, Object o2) { return ((o1 == null && o2 == null) || (o1 != null && o1.equals(o2))); } }