0 votes
in Education by (1.7m points)
Which of these is an incorrect form of using method max() to obtain a maximum element?

(a) max(Collection c)

(b) max(Collection c, Comparator comp)

(c) max(Comparator comp)

(d) max(List c)

This question was addressed to me during an interview.

This question is from Collection Algorithms in division java.util – The Collections Framework of Java

Select the correct answer from above options

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by (1.7m points)
The correct choice is (c) max(Comparator comp)

To explain: Its illegal to call max() only with comparator, we need to give the collection to be searched into.

Related questions