What is the output of the following code?
public class Test {
public static void main(String[] args) {
| String s1 = new String("Welcome to Java!"); |
| String s2 = s1.toUpperCase(); |
| System.out.println("s1 and s2 reference to the same String object"); |
| System.out.println("s1 and s2 have the same contents"); |
| System.out.println("s1 and s2 have different contents"); |
}
}
◦ s1 and s2 reference to the same String object
◦ s1 and s2 have different contents
◦ s1 and s2 have the same contents