About 1,060 results
Open links in new tab
  1. Java String compareTo() Method with Examples - GeeksforGeeks

    Jan 20, 2025 · The compareTo() method of UUID class in Java is used to compare one UUID value with another specified UUID. It returns -1 if this UUID is less than the value, 0 if this …

  2. writing a public int compareTo () method java - Stack Overflow

    Mar 18, 2011 · The compareTo() method is used to compare two objects which have multiple properties. It will return an integer to indicate which of the objects that was compared is larger. …

  3. Guide to Implementing the compareTo Method - Baeldung

    Jan 8, 2024 · Java allows us to implement various sorting algorithms with any type of data. For example, we can sort strings in alphabetical order, reverse alphabetical order, or based on …

  4. Java String compareTo() Method - W3Schools

    The compareTo() method compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. The method returns 0 if the string is equal …

  5. java - How do I write a compareTo method which compares …

    The compareTo method is described as follows: Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal …

  6. Java | ==, equals(), compareTo(), equalsIgnoreCase() and compare()

    Mar 6, 2023 · In Java, string equals () method compares the two given strings based on the data / content of the string. If all the contents of both the strings are same then it returns true. If all …

  7. java - Implementing custom compareTo - Stack Overflow

    Dec 20, 2016 · @Override public int compareTo(Object t) { if(t instanceof Student) { Student s = (Student)t; return (this.name.compareTo(s.name)); } else return -1; } This is my compareTo …

  8. Beginner's Guide To compareto In Java (With Code Examples)

    Master Java’s compareTo method in minutes! Learn how to compare objects, avoid common mistakes, and write cleaner code with hands-on examples.

  9. Java String compareTo() Method with examples - BeginnersBook

    Sep 16, 2022 · The Java String compareTo() method is used for comparing two strings lexicographically. Each character of both the strings is converted into a Unicode value for …

  10. Mastering the CompareTo Method in Java: A Comprehensive …

    In Java, the CompareTo method is a crucial part of the Comparable interface, which allows objects to define their natural ordering. This tutorial will guide you through the implementation …

  11. Some results have been removed
Refresh