Which of the following are valid calls to Math.max? 1. Math.max(1,4) 2. Math.max(2.3, 5) 3. Math.max(1, 3, 5, 7) 4. Math.max(-1.5, -2.8f)

Review the verified answer and explanation for this DemoPaper-Pakistan past-paper question on CampusFin.

Which of the following are valid calls to Math.max? 1. Math.max(1,4) 2. Math.max(2.3, 5) 3. Math.max(1, 3, 5, 7) 4. Math.max(-1.5, -2.8f) Answer: 1, 2 and 4

(1), (2), and (4) are correct. The max() method is overloaded to take two arguments of type int, long, float, or double. (3) is incorrect because the max() method only takes two arguments.

Question context

This question is part of ☕ Java Programming within the broader 💻 Programming subject and appears in the DemoPaper-Pakistan preparation collection. Reviewing the answer together with nearby questions helps reinforce the underlying concept and identify how it may appear in competitive exams.