hey,
I think in your code the function you used to compare the words its not right,
So you can check your code with .equals() function
public static void main(String args[])
{
String string1 ="Garments" ;
String string2 = "Dog";
System.out.println("Comparing " + string1 + " and " + string2
+ " : " + string1.equalsIgnoreCase(string2));
Thank you