What will be the result of attempting to compile and run the following program?.
public class Main { public static void main(String[] args) { String s = "hello"; StringBuilder sb = new StringBuilder(s); sb.reverse();//w w w. j a v a2 s. com if (s == sb) System.out.println("a"); if (s.equals(sb)) System.out.println("b"); if (sb.equals(s)) System.out.println("c"); } }
Select the one correct answer.
(b)
The code will fail to compile since the expression (s == sb) is illegal.
It compares references of two classes that are not related.