About 7,450 results
Open links in new tab
  1. Java String compareTo () Method - W3Schools

    Definition and Usage 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 …

  2. Java String compareTo() Method with Examples - GeeksforGeeks

    Jan 20, 2025 · The String class of Java comprises a lot of methods to execute various operations on strings and we will be focusing on the Java String compareTo () method in this article.

  3. Guide to Implementing the compareTo Method - Baeldung

    Feb 8, 2021 · In this tutorial, we’ll explore the Comparable interface and its compareTo method, which enables sorting. We’ll look at sorting collections that contain objects from both core and custom classes.

  4. Java String compareTo () Method - Tpoint Tech

    Mar 17, 2025 · The compareTo () method in Java's String class compares two strings lexicographically. It compares strings on the basis of the Unicode value of each character in the strings.

  5. Java String compareTo () - HowToDoInJava

    Jan 11, 2023 · Java String.compareTo () compares two strings lexicographically (in dictionary order) in a case-sensitive manner. For case-insensitive comparison, use compareToIgnoreCase () method.

  6. Java String compareTo Method With Programming Examples

    Apr 1, 2025 · In this tutorial, we will learn about the Java String compareTo () method and see how and when to use compareTo in Java along with syntax and examples.

  7. Java String CompareTo () Method - CodeGym

    Dec 25, 2024 · The java string class compareTo () method returns the 0 value if both strings are lexicographically equal. If the compared string is greater lexicographically then the positive value is …

  8. Java - String compareTo () Method: A Comprehensive Guide

    The compareTo() method in Java’s String class provides a way to compare two strings lexicographically. This blog post will delve deep into the compareTo() method, covering its fundamental concepts, …

  9. Java - String compareTo () Method - Online Tutorials Library

    The Java String compareTo () method is used to compare two strings lexicographically. It returns an integer value, and the comparison is based on the Unicode value of each character in the strings.

  10. Java String compareTo () - Programiz

    The compareTo() method compares two strings lexicographically (in the dictionary order). The comparison is based on the Unicode value of each character in the strings.