- 2
How is that the correct answer?
The question is asking me what is the output, but it says that the output is 11.
6 Respostas
0
needs more detail. what was the question?
0
tell us the question so we can help
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.
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
0
the output is 40
0
am still confused of this answer "11" instead of "a"