- 2

How is that the correct answer?

The question is asking me what is the output, but it says that the output is 11.

6th Dec 2016, 8:17 PM
William Sanborn
William Sanborn - avatar
6 Antworten
0
needs more detail. what was the question?
7th Dec 2016, 2:29 AM
Ed Magalhaes
Ed Magalhaes - avatar
0
tell us the question so we can help
7th Dec 2016, 11:40 AM
Shaima
0
What is the output of the following code? int a=11; int b = 12; int c=40; if(a>100||b>3){ System.out.println(a); }else { System.out.println(c); } That was the question.
8th Dec 2016, 2:47 AM
William Sanborn
William Sanborn - avatar
0
a = 11 and b= 12 so once we check if condition a is not greater than 100 but b is greater than 12 in if statement they are using OR operation so one of the conditions should be true to make the statement true and excute what inside {} so ( a>100 )False OR (b>3) True = True finaly if condition is true now we can enter {} and excute System.out.print(a); the output will be 11 Note: if u r using && -AND- operator then both conditions should be true to make the whole statement true. if u r using || -OR- operator then one of the conditions should be true to make the whole statement true
8th Dec 2016, 11:56 AM
Shaima
0
the output is 40
10th Dec 2016, 10:05 AM
ahmad albardine
ahmad albardine - avatar
0
am still confused of this answer "11" instead of "a"
15th Apr 2021, 3:58 PM
Jgam Flomo
Jgam Flomo - avatar