This topic contains a solution. Click here to go to the answer

Author Question: What is the output of the following code?public class Test { public static void main(String[] args) ... (Read 23 times)

Tirant22

  • Hero Member
  • *****
  • Posts: 532
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;
s1 += "and Welcome to HTML";
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 different String objects
◦ s1 and s2 reference to the same String object


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by Tirant22 on May 6, 2020

dellikani2015

  • Sr. Member
  • ****
  • Posts: 332
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 39% of students answer this correctly




Tirant22

  • Member
  • Posts: 532
Reply 2 on: May 6, 2020
Great answer, keep it coming :)


miss.ashley

  • Member
  • Posts: 371
Reply 3 on: Yesterday
Gracias!

 

Did you know?

Bacteria have flourished on the earth for over three billion years. They were the first life forms on the planet.

Did you know?

Bacteria have been found alive in a lake buried one half mile under ice in Antarctica.

Did you know?

About 3.2 billion people, nearly half the world population, are at risk for malaria. In 2015, there are about 214 million malaria cases and an estimated 438,000 malaria deaths.

Did you know?

The first monoclonal antibodies were made exclusively from mouse cells. Some are now fully human, which means they are likely to be safer and may be more effective than older monoclonal antibodies.

Did you know?

Cutaneous mucormycosis is a rare fungal infection that has been fatal in at least 29% of cases, and in as many as 83% of cases, depending on the patient's health prior to infection. It has occurred often after natural disasters such as tornados, and early treatment is essential.

For a complete list of videos, visit our video library