Predict the output of the following Java program snippet:
System.out.println(Math.max(Math.ceil(14.55),15.5));
36 Likes
15.5
Math.ceil(14.55) gives 15.0 as it is the smallest whole number greater than 14.55. After that Math.Max() becomes Math.max(15.0, 15.5). As 15.5 is greater than 15.0, it is the output.
Answered By
22 Likes