Question on sort meothed in LinkedList

Iam anew member , and I have question
My question is why sort method in LinkedList can not sort String typ and integer typ in the same list. For example if we creat list of LinkedList with integer numbers and string names
The code
in the test class Iam using Java API
LinkedList list = new LikedList();
list.add(new Integer(1));
list.add(“AAAAA”);
list.add(new Integer(6));
list.add(“BBBBB”);

//then when we print them
System.out.print(“List is :” + list);
this will be the result
List is : [1, AAAAA, 6, BBBBB]
but when we try to sort them
Collections.sort(list);
System.out.print("Sorted list is " + list);
the result will give me error, because sort method can not sort two diffrenet data typ in the same list
I want to know why that can not happen… where is the exzatly problem in the sort method that make can not do this…why we can not compare name(string data typ) with number (integer data typ)

I will be greatful if any on e can help me and answer my question …
someone told me that String objects are compared lexicographically and numbers by magnitude, I want to know how it is work.

You have added 2 types of objects one is string, integer try to convert the integer object into string object before sorting the list or vector what ever . and then sort the list then it will work

Pradeep.Jaladi