Java String equalsIgnoreCase() Method

You are Here:

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)); } }

Output

true true

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.

Reminder

Hi Developers, we almost covered 90% of String functions and Interview Question on Java with examples for quick and easy learning.

We are working to cover every Single Concept in Java.

Please do google search for:

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