Java String comparison is not working -


public static void main(string[] args) {         string = "hi ";         string a1 = "hi am";         if (a1.equalsignorecase(a)) {             system.out.println("equal");         } else {             system.out.println("not equal");         }     } 

why above code displaying not equal in console?

the first string has additional space @ end, it's not equal second string.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

spring cloud - How to configure SpringCloud Eureka instance to point to https on non standard port -

javascript - Bootstrap Popover: iOS Safari strange behaviour -