Saved Bookmarks
| 1. |
Predict the output of the following snippets. (2)val = 1600; int val, sum, n=550; sum=n+val>1750?400:200; System.out.println(sum); |
Answer» Question:-
int val = 1600; int sum, n=550; sum=n+val>1750?400:200; System.out.println(sum); _____________________Output:-400 _______________________Answer with Explaination:-Initially, val =1600 and n=550 sum=n+val>1750?400:200; n+val=1600+550=2150 So, 2150 >1750.....True So,sum will GET 400 Hence the correct output is 400. |
|