What is the result of the following code?
public class Main{ public static void main(String[] argv){ String s1 = "java"; StringBuilder s2 = new StringBuilder("java"); if (s1 == s2) //line A System.out.print("1"); if (s1.equals(s2)) System.out.print("2"); } }
A.
Java does not allow you to compare String and StringBuilder using ==. The compiler will tell you that the incompatible operand type.