Java examples for java.lang:String Compare
Compare two string for equal
public class Main{ public static void main(String[] argv){ String l = "java2s.com"; String r = "java2s.com"; System.out.println(equals(l,r)); }/*from w ww . ja v a2 s .c o m*/ public static boolean equals(String l, String r) { if (l != r) { if (l != null || r != null) { return l.equals(r); } return false; } return true; } public static boolean equals(String l, String r) { if (l != r) { if (l != null || r != null) { return l.equals(r); } return false; } return true; } }