Equivalence : Equals « Class « Java


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

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


Related examples in the same category

1.Equals(Equal) MethodEquals(Equal) Method
2.Equals MethodEquals Method
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