public class eqignore
{
public static void main(String args[])
{
String s1="Gulzar";
String s2="Gulzar";
String s3="GULZAR";
String s4="Ludhiana";
System.out.println("The Strings Gulzar and Gulzar are same = " + s1.equalsIgnoreCase(s2));
//true because content and case is same
System.out.println("The Strings Gulzar and GULZAR are same = " + s1.equalsIgnoreCase(s3));
//true because contents are same and use of ignore case is there
System.out.println("The Strings Gulzar and Ludhiana are same = " + s1.equalsIgnoreCase(s4));
//false because content is not same
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.