I compiled the following 2 java programs, the first one gives compilation error, the 2nd one compiles fine.
The first program, the compiler does not recognize the command "Collections.sort(s)". Could anyone please throw some light on it please.
The sort() method in Collections utility class takes in only objects of the type "List". Just since
the List interface extends from Collection interface doesn't mean you can directly cast it into the method.
May be this could help solve your confusion.