Java Integer.compare(int x, int y)

Syntax

Integer.compare(int x, int y) has the following syntax.

public static int compare(int x,  int y)

Example

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


public class Main {
  public static void main(String[] args) {
    if(Integer.compare(1,  1)== 0){
       System.out.println("Equals");
    }// w ww.j  a  v a2 s  .  c om
    
  }
}

The code above generates the following result.





















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