How do you check if a char is equal to a string?

Check Equal Char Using the compare() Method in Java The compare() method belongs to the String class and returns 0 if both the values are equal. Here, we used this method with the == equals operator to verify if it returns 0 or not. If it returns 0, then both values are equal.

Sizin İçin Seçtik  How do you find the length of a string in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *