The IT Certification Resource Center

Featured Deal

Get CompTIA, Cisco, and Microsoft training courses free for a week.
Learn More ❯

Question 26:

Which of the following lines will print false?

1.    public class MyClass
2.    {
3.        static String s1 = "I am unique!";
4.        public static void main(String args[])
5.        {
6.            String s2 = "I am unique!";
7.            String s3 = new String(s1);
8.            System.out.println(s1 == s2);
9.            System.out.println(s1.equals(s2));
10.            System.out.println(s3 == s1);
11.            System.out.println(s3.equals(s1));
12.            System.out.println(TestClass.s4 == s1);
13.        }
14.    }
15.
16.    class TestClass
17.    {
18.        static String s4 = "I am unique!";
19.    }

A. Lines 10 and 12
B. Line 12 only
C. Line 8 and 10
D. None of these