Java String equalsIgnoreCase() method

In this program, You will learn how to implement the String equalsIgnoreCase() method in java.

if (a.equalsIgnoreCase(b)) { 

Example: How to implement String equalsIgnoreCase() method in java.

import java.util.Scanner;

class Main {
    public static void main(String args[]) {

        Scanner sc = new Scanner(;
        String a, b;

        System.out.print("Enter first string:");
        a = sc.nextLine();
        System.out.print("Enter second string:");
        b = sc.nextLine();

        if (a.equalsIgnoreCase(b)) {
            System.out.println("Both Strings are equal");
        } else {
            System.out.println("Both Strings are not equal");



Enter first string:XIITH
Enter second string:xiith
Both Strings are equal

Xiith is created for educational, experimental, and schooling purpose. Examples on Xiith are made easier to make a better or basic understanding. Tutorials, testimonials, and examples are continuously checked to avoid delusion, but we cannot take complete responsibility of all programs on Xiith. When you are operating this site, you have to agree to read and accept our terms of use, cookie and privacy policy.Copyright © 2020 by Xiith. All Rights Reserved. About us.