State the output of k
int a=9 , b=8, c=5 ;
boolean k= ( a>b && b>c ) || !( c>a) ;
System.out.println( k);
Answers
Answered by
0
Answer:
k will result in true as both the conditions are true as(8>5&&8>5)|| !(5>8) as first expression is true and also the second expression is also true so the result is true.
Note:- The second expression is true as ! is not and 5>8 which is false so it means not greater which is true hence it's true.
Note:In OR(||) if one of the expressions is true the result is true and in And(&&) both the expressions should be true otherwise it will result in false.
Similar questions