Cognizant interview question

How to re-write sort method in Java?

Interview Answer

Anonymous

1 Mar 2019

Implement the Comparator interface and rewrite the compare method inside the object.