Java Object.equals(Object obj)

Syntax

Object.equals(Object obj) has the following syntax.

public boolean equals(Object obj)

Example

In the following code shows how to use Object.equals(Object obj) method.


/*from   w w  w.  ja v a 2  s  .c  o m*/
public class Main {

   public static void main(String[] args) {
      Integer x = new Integer(50);
      Float y = new Float(50f);

      System.out.println(x.equals(y));
      System.out.println(x.equals(50));

   }
}




















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable