MCQs > IT & Programming > Kotlin > You have written a function, sort(), that should accept only collections that implement the Comparable interface. How can you restrict the function? fun sort(list: List): List { return list.sorted()}

Kotlin MCQs

You have written a function, sort(), that should accept only collections that implement the Comparable interface. How can you restrict the function? fun sort(list: List): List { return list.sorted()}

Answer

Correct Answer: Add > between the fun keyword and the function name

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Kotlin Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Kotlin Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it