Write a string equalsIgnoreCase() program

Write a string equalsIgnoreCase() program

Program
import java.util.Scanner;
public class Main
{
    public static void main(String args[])
    {
        String s1,s2;
        Scanner sc=new Scanner(System.in);
        System.out.print("Enter String 1 : ");
        s1=sc.nextLine();
        System.out.print("Enter String 2 : ");
        s2=sc.nextLine();
        int n=s1.equalsIgnoreCase((s2);
        if(n==0)
        {
            System.out.println("Both are equal");
        }
        else
        {
            System.out.println("Both are not equal");
        }
    }
}


Output:

Enter String 1 : Sateesh
Enter String 2 : SATEESH
Both are equal


Strings Handling In Java



More Questions


181 . Write a string equalsIgnoreCase() program
182 . Write a string startsWith() program
183 . Write a string endsWith() program
184 . Write a string indexOf() program
185 . Write a string lastIndexOf() program
186 . Write a String substring() program
187 . Write a string trim() program
188 . Write a StringBuffer insert() program
189 . Write a StringBuffer delete() program
190 . Write a StringBuffer append() program
191 . Write a StringBuffer replace() Program