Java Data Type Tutorial - Java Long.compare(long x, long y)








Syntax

Long.compare(long x, long y) has the following syntax.

public static int compare(long x,  long y)

Example

In the following code shows how to use Long.compare(long x, long y) method.

/*from  w  ww . java2s  .  c  o  m*/
public class Main {

   public static void main(String[] args) {

    
     System.out.println(Long.compare(1L,  2L));

 
   }
}

The code above generates the following result.