Here you can find the source of equals(Object x, Object y)
public static boolean equals(Object x, Object y)
//package com.java2s; /*/*from w ww . jav a 2s.co m*/ * ComparatorHelper.java 2005-7-17 * * ??????: ???????(FTO)???? 2000-2005, ?????????. * ????????????(FTO)???????????????????????????????????????? * * Copyright 2000-2005 FTO Software Team, Inc. All Rights Reserved. * This software is the proprietary information of FTO Software Team, Inc. * Use is subject to license terms. * * FTO???http://www.free-think.org */ import java.util.Arrays; public class Main { public static boolean equals(Object x, Object y) { return x == y || (x != null && y != null && x.equals(y)); } public static boolean equals(Object[] xs, Object[] ys) { return Arrays.equals(xs, ys); // if(xs==ys){ // return true; // } // if(xs==null || ys==null){ // return false; // } // int xslen = xs.length; // int yslen = ys.length; // if(xslen != yslen){ // return false; // } // for(int i=0;i<xslen;i++){ // if(equals(xs[i], ys[i])==false){ // return false; // } // } // return true; } }