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

Justin works as a car salesman. Last week he had a total of 42,000 dollars in sales. if his Commission is 2 percent how much did Justin earn and last week?
How are ice and water involved in mechanical weathering
Cassandra drove 370.5 Miles in 6.5 hrs. How many miles per hour did she drive? (:
A speedy river barge bound for New Orleans, Louisiana leaves Baton Rouge at 9:00 a.m. and travels at a speed of 10 miles per hour. A rail transport freight also
What happened during the holocaust?
Justin works as a car salesman. Last week he had a total of 42,000 dollars in sales. if his Commission is 2 percent how much did Justin earn and last week?
How to show your work to solve  3r^2-16r-7=5
An object has a weight of 5.10 Newtons (N) at sea level, where the acceleration due to gravity is 9.81 m/s2. What is the acceleration due to gravity on the obje
in an A.P,the sum of first ten terms is -150 and the sum of next 10 terms is -550.Find the A.P
Why can't you change the subscripts in a formula in order to balance a chemical equation?