The following determines the functions for comparing Strings in Java
String s = "String_1", t = "String_2";
if (s == t) // it usually will not match
if (s.equals(t)) // this is the right way
if (s.compareTo(t) > 0) // this is also correct>
No comments:
Post a Comment