Computer Applications
if (a>b&&b>c) then largest number is:
- b
- c
- a
- wrong expression
Java Operators
ICSE 2024
12 Likes
Answer
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.
Answered By
5 Likes
Related Questions
The output of the statement "talent".compareTo("genius") is:
- 11
- –11
- 0
- 13
Which of the following is an escape sequence character in Java?
/n\t/t//n
What is the output of Math.ceil(5.4)+Math.ceil(4.5)?
- 10.0
- 11.0
- 12.0
- 9.0
What is the method to check whether a character is a letter or digit?
- isDigit(char)
- isLetterOrDigit()
- isLetterOrDigit(char)
- isLETTERorDIGIT(char)