Computer Certification

  1. Home
  2. Computing & Technology
  3. Computer Certification

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.       }

 

Lines 10 and 12
Line 12 only
Lines 8 and 10
None of these

Back to beginning | Next Question



Explore Computer Certification

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Computer Certification

  1. Home
  2. Computing & Technology
  3. Computer Certification

©2009 About.com, a part of The New York Times Company.

All rights reserved.