Computer Science, asked by nakul4948, 11 months ago

What is the value returned by the method f() defined below public static int f(int x, int y) {return (x>y) ? y: x;}

Answers

Answered by lovingheart
4

Syntax of Ternary operator:

Condition? True block: false block

The statement given in return is “(x>y) ? y : x” where ? is the ternary operator. If the condition is true, true block is executed otherwise false block is executed.

The method returns value of x or y according to the value of x and y. whenever x is greater than y, the value of y is returned otherwise the value of x is returned.  

Similar questions