The signature of equals() from Object class is 'public boolean equals(Object object)' : equals method « Utility Classes « SCJP






public class MainClass {
  public static void main(String[] argv) {

    MyClass myClass = new MyClass();

    MainClass mainClass = new MainClass();

    System.out.println(myClass.equals(mainClass));
  }
}

class MyClass {
  public boolean equals(Object object) {
    if (object instanceof MyClass == false) {
      return false;
    }
    return true;
  }
}
false








8.2.equals method
8.2.1.equals() and hashCode()
8.2.2.The signature of equals() from Object class is 'public boolean equals(Object object)'
8.2.3.Implementing an equals() Method