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

Author Question: What is y displayed in the following code?public class Test1 { public static void main(String[] ... (Read 63 times)

folubunmi

  • Hero Member
  • *****
  • Posts: 524
What is y displayed in the following code?

public class Test1 {
public static void main(String[] args) {
int x = 1;
int y = x = x + 1;
System.out.println("y is " + y);
}
}

◦ y is 0.
◦ y is 2 because x + 1 is assigned to x and then x is assigned to y.
◦ The program has a compile error since x is redeclared in the statement int y = x = x + 1.
◦ y is 1 because x is assigned to y first.


Related Topics

Need homework help now?

Ask unlimited questions for free

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

Loise Hard

  • Sr. Member
  • ****
  • Posts: 340
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




folubunmi

  • Member
  • Posts: 524
Reply 2 on: May 6, 2020
YES! Correct, THANKS for helping me on my review


bigsis44

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

 

Did you know?

The shortest mature adult human of whom there is independent evidence was Gul Mohammed in India. In 1990, he was measured in New Delhi and stood 22.5 inches tall.

Did you know?

More than 150,000 Americans killed by cardiovascular disease are younger than the age of 65 years.

Did you know?

Vampire bats have a natural anticoagulant in their saliva that permits continuous bleeding after they painlessly open a wound with their incisors. This capillary blood does not cause any significant blood loss to their victims.

Did you know?

The National Institutes of Health have supported research into acupuncture. This has shown that acupuncture significantly reduced pain associated with osteoarthritis of the knee, when used as a complement to conventional therapies.

Did you know?

Approximately 500,000 babies are born each year in the United States to teenage mothers.

For a complete list of videos, visit our video library