Long.compareTo(Long anotherLong) has the following syntax.
public int compareTo(Long anotherLong)
In the following code shows how to use Long.compareTo(Long anotherLong) method.
public class Main { public static void main(String[] args) { Long long1 = new Long(12345L); Long long2 = new Long("12346"); System.out.println(long1.compareTo(long2)); } }
The output: