carriganlee1375 carriganlee1375
  • 25-01-2021
  • Computers and Technology
contestada

What is the output of the following code snippet? int s1 = 20; if (s1 <= 20) { System.out.print("1"); } if (s1 <= 40) { System.out.print("2"); } if (s1 <= 20) { System.out.print("3"); }

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 25-01-2021

Answer:

The program outputs 123

Explanation:

The first line of the program initializes s1 to 20

The second line checks if s1 is less than or equal to 20.

This is true,

So, 1 is printed

The third line checks if s1 is less than or equal to 40.

This is true,

So, 2 is printed

The fourth line checks if s1 is less than or equal to 20.

This is true,

So, 3 is printed

Hence, the output is 123

Answer Link

Otras preguntas

hyperlink is a feature that A. calculates data in the cell B. connect text in a document to an outside source. C. saves a worksheet to the OneDrive D. tracks th
dora filed for chapter 13 bankruptcy in 2011. even if she planned to take the maximum time allowed under chapter 13 to repay her debts she must have planned to
You travel in a circle, whose circumference is 8 kilometers, at an average speed of 8 kilometers/hour. If you stop at the same point you started from, what is y
F(x)=9x3+2x2-5x+4amd g(x) =5x3-7+4
Why were Americans so concerned about communists in their communities during the Cold War?
Pleaseee help asap.
Which equation is equivalent to 5√X+8=35? A. 3√x+8=175 B. X+8=343 C. X+8=21 D. X=351
Nancy es de Guatemala. Ella es A) guatemalteca B) guatemalteco
PLEASE HELP QUICKCelia uses the steps below to solve the equation -3/8(-8-16d)+2d=24Step 1 Distribute -3/8 over the expression in parentheses. 3
zmzmmskalaonnannmmKkaamwai. A key glass oi