Computer Certification

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

Question 27

What is displayed when the following code is compiled and executed?

 

String s1 = new String("Test");

String s2 = new String("Test");

 

if (s1==s2)

          System.out.println("Same");

 

if (s1.equals(s2))

          System.out.println("Equals");

 

Same
Equals
The code compiles, but nothing is displayed upon execution.
The code fails to compile.

Back to beginning
| Next Question



Explore Computer Certification

About.com Special Features

Computer Certification

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

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

All rights reserved.