Biology Forums - Study Force

Science-Related Homework Help Computer Studies Topic started by: Lopezj273 on May 5, 2020



Title: What is the output of the following code?public class Test { public static void main(String[] args) ...
Post by: Lopezj273 on May 5, 2020
What is the output of the following code?

public class Test {
public static void main(String[] args) {
String s1 = "Welcome to Java!";
String s2 = s1;
if (s1 == s2)
System.out.println("s1 and s2 reference to the same String object");
else
System.out.println("s1 and s2 reference to different String objects");
}
}


▸ s1 and s2 reference to the same String object

▸ s1 and s2 reference to different String objects


Title: What is the output of the following code?public class Test { public static void main(String[] args) ...
Post by: wasan on May 5, 2020
Content hidden