Which of the following implementations of a max() method will correctly return the largest value?
// (1) int max(int x, int y) { return (if (x > y) { x; } else { y; }); } // (2) int max(int x, int y) { return (if (x > y) { return x; } else { return y; }); } // (3) int max(int x, int y) { switch (x < y) { case true: return y; default: return x; }; } // (4) int max(int x, int y) { if (x>y) return x; return y; } Select the one correct answer. a. Implementation labeled (1). b. Implementation labeled (2). c. Implementation labeled (3). d. Implementation labeled (4).
Related Questions
- Can I override the equals method or clone method from class Object to take a parameter or return a value of the type that I specify?
- If I become eligible to use the instalment method for GST after the first quarter, what period will the Annual GST return cover?
- What happens if the return value of a proxy method is incorrect?