this question is from Master Exam,
Test prep software
import java.util.*;
class comp2
{
public static void main(
String []args)
{
String words[] = {"Good","Bad","Ugly"};
Comparator<String> best = new Comparator<String>(){
public int compare(String s1, String s2)
{
return s2.charAt(1)-s1.charAt(1);//what is happening here?
}
};
Arrays.sort(words, best);
System.out.println(words[0]);
}
}
what is happening in the question? please help
thanks in advance