Computer Science, asked by MKhetan, 1 year ago

predict the output in java....

Attachments:

Answers

Answered by sswaraj04
3

Answer:

Explanation:

(i) p = 1

switch(1)

case 1: a++;  ---->  a = 2

no break here so it will continue

case 2:++b;  -----> b = 3

break;

print(a,b,c)   ------> 2,3,3

So output is

2,3,3

(ii) p = 3

switch(3)

case 3:c--;   ----> c=2

end of switch

print(a,b,c) ----> 1,2,2

so output is

1,2,2

Hope it helps :-)

Answered by Brenquoler
28

a 1

b 3

c 3

\pink{▬▬▬▬▬}\red{Mark}\green{As}\blue{Brainliest}\orange{▬▬▬▬▬}

{\fcolorbox{blue}{black}{\orange{\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\: DecentMortal\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:}}}

Similar questions