1.

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

Answer»

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.



Discussion

No Comment Found

Related InterviewSolutions