• 2022-06-07
    调用以下类D和E的main() 方法的输出结果为?class D { public static void main(String[] args) { String s1 = new String("hello"); String s2 = new String("hello"); if (s1.equals(s2)) System.out.println("equal"); else System.out.println("not equal"); }} class E { public static void main(String[] args) { StringBuffer sb1 = new StringBuffer("hello"); StringBuffer sb2 = new StringBuffer("hello"); if (sb1.equals(sb2)) System.out.println("equal"); else System.out.println("not equal"); }}
    A: D: equal; E: equal
    B: D: not equal; E: not equal
    C: D: equal; E: not equal
    D: D: not equal; E: equal