Equals Method : Equals « Class « Java






Equals Method

Equals Method
   

//: c03:EqualsMethod.java
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.


public class EqualsMethod {

  public static void main(String[] args) {
    Integer n1 = new Integer(47);
    Integer n2 = new Integer(47);
    System.out.println(n1.equals(n2));
  }
} ///:~


           
         
    
    
  








Related examples in the same category

1.Equals(Equal) MethodEquals(Equal) Method
2.Equivalence
3.If the given objects are equal
4.Equivalence ClassSet
5.Test the equality of two object arrays
6.Compares two objects for equality, where either one or both objects may be null
7.This program demonstrates the equals method