.equals() method not comparing two Strings in java

Its usually happen when we try to compare Two String in java even if both the Strings are same it doesn’t compare because of space and we don’t focus on that

to solve this problem use trim() method


String str1 = “evaavi.com”;
String str2= “evaavi.com”;
System.out.println(“Hello evaavi.com”);

Leave a Reply