import java.util.*; public class StringConcat { void test(String s1, String s2) { if (s1.equals("foo") && s2.equals("bar")) { String res = s1 + s2; if (res.equals("foobar")) { } } if (s1.startsWith("foo") && s2.startsWith("bar")) { String res = s1 + s2; if (res.length() < 6) {} } } }