Java – String equalsIgnoreCase() Example

String objects can be compared by equalsIgnoreCase() method in java without case senstive. equalsIgnoreCase() method returns value in boolean. If string objects are matched with each other in string, it will return true, otherwise false. Use of String equalsIgnoreCase() in java is shown below.

Example of String equalsIgnoreCase() in java, JSP

public class StringEqualsIgnoreCaseExample {

    public static void main(String[] args) {

        String string = "Comparing strings";

        // equalsIgnore ignore case sense while comparing

        boolean checkEqualsString = string.equalsIgnoreCase("comparing STRINGS");

        System.out.println("Comparing string Match :"+checkEqualsString);

    }
}

Check More equals method in java String equals()

Output

Comparing string Match :true

Tags:

Bookmark  

 

Leave a Reply

Security Code:

 

  Random Post