A string can be compared with a StringBuffer
public class Main { public static void main(String[] argv) throws Exception { String s1 = "s1"; StringBuffer sbuf = new StringBuffer("a"); boolean b = s1.contentEquals(sbuf); } }