Java String equalsIgnoreCase() Method

Java String equalsIgnoreCase()

The equalsIgnoreCase() method checks whether the two specified String objects have the same value or not, irrespective of the case of the string.

Note: This method is case-insensitive.

Example

Java Compiler
public class myClass { public static void main(String[] args) { String str1 = "JOHN DOE"; String str2 = "john doe"; String str3 = "JOHN DOE"; System.out.println(str1.equalsIgnoreCase(str2)); System.out.println(str1.equalsIgnoreCase(str3)); } }

Syntax

public bool str1.equalsIgnoreCase(str2)

Parameter Values

ValueTypeExplanation
str1RequiredSpecifies the string to be compared.
str2RequiredSpecifies the string to be compared.

Return Value

ValueExplanation
trueIf the two specified String objects have the same value.
falseIf the two specified String objects does not have the same value.

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author