1(vii)
if (a>b&&b>c) then largest number is:
- (a)b
- (b)c
- (c)a
- (d)wrong expression
Show SolutionHide Solution↓
a
Reason — The && (Logical AND) operator in Java is used to combine two boolean expressions. It returns true only if both expressions are true. If either of the expressions is false, the entire condition becomes false.
The condition if (a > b && b > c) checks two expressions:
a > b– Checks ifais greater thanb.b > c– Checks ifbis greater thanc.
Since both conditions must be true (due to the && operator), the logical sequence becomes:
a > b > c
In this sequence:a is the largest number because it is greater than both b and c.