Kowalaholic
Kowalaholic Kowalaholic
  • 23-01-2020
  • Computers and Technology
contestada

What is the output of the following statement?
System.out.println("1 + 2\n"
+ "3 - 4\n" + "=\n" + (1 + 2)
+ "\n" + (3 + 4));

Respuesta :

Aalsharaphy
Aalsharaphy Aalsharaphy
  • 26-01-2020

Answer:

1 + 2

3 - 4

=

3

7

Explanation:

1 + 2 (it print the string "1+2" and goes to a new line

3 - 4 (it print the string "3-4" and goes to a new line)

= (it print the string "=" and goes to a new line)

3 (it perform arithmetic operation on 1+2 to give 3)

( It create empty new line)

7. (it perform arithmetic operation on 3+4 to give 7)

Answer Link

Otras preguntas

What do you think drove Genghis Khan to conquer a great empire? Explain your answer.
The volume of 100 drops of a liquid is 1 fluid ounce. What is the volume of 10 drops?
How did the Treaty of Versailles trigger the May Fourth Movement?
The volume of 100 drops of a liquid is 1 fluid ounce. What is the volume of 10 drops?
x^2 -3x + 0 = 0 Factor and solve
How do the mass media spread popular culture across the world?
What was the outcome of the Battle of Tours?
Was the United States right to reject the Treaty of Versailles? Why or why not?
(27 p - 6)^5, when p = 28
75% of a certain number is 24. What is the number?