Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2007 Pascal Essiembre. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Pascal Essiembre - initial API and implementation ******************************************************************************/ public class Main { /** * Null-safe testing of two objects for equality. * * @param o1 * object 1 * @param o2 * object 2 * @return <code>true</code> if to objects are equal or if they are both * <code>null</code>. */ public static boolean equals(Object o1, Object o2) { return (o1 == null && o2 == null || o1 != null && o1.equals(o2)); } }