Java Long.equals(Object obj)

Syntax

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

public boolean equals(Object obj)

Example

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

If you just want to check the equality,


public class Main {
  public static void main(String[] args) {
    Long long1 = new Long(12345L);
    Long long2 = new Long("12346");
    /*from w  w  w.  j  ava  2s .  c o m*/
    System.out.println(long1.equals(long2));
  }
}

The output:





















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