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
Post a Comment