Here you can find the source of equal(String s1, String s2)
public static boolean equal(String s1, String s2)
//package com.java2s; public class Main { public static boolean equal(String s1, String s2) { if (s1 == s2) { return true; }//from ww w . ja v a 2 s . com if (s1 == null) { return false; } return s1.equals(s2); } }