Equals(Equal) Method : Equals « Class « Java






Equals(Equal) Method

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


class Value {
  int i;
}

public class EqualsMethod2 {

  public static void main(String[] args) {
    Value v1 = new Value();
    Value v2 = new Value();
    v1.i = v2.i = 100;
    System.out.println(v1.equals(v2));
  }
} ///:~


           
         
    
    
  








Related examples in the same category

1.Equals MethodEquals 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