1) Please check your ObjComp constructor, the instance member "name" will contain null for all of the objects.
2) Provide a valid implementation of public String toString() if you want to print out the list elements. (Check out Arrays.toString() method as well. <It is really interesting>)
Soumya Ranjan Mohanty wrote:Would you please modify my code and make it working. I want to sort the elements in the ArrayList Using the Collections.sort().