What is the integer value in case of -ve integer and +ve integer, and how does it compare the whole string array, and how would it sort................ please help me with it.
It doesn't matter what the value is that is returned -- all the sorting algorithm does is check whether the response is positive, negative, or zero. This is why certain classes -- such as for the Integer, Short, Byte, etc. -- just takes a difference. As depending on whether it is greater, less, or equal will generate a negative, positive, or zero difference.
As for strings, the difference is only done for the first character, and returned if it is positive or negative. If zero, then the comparison moves to the next character.
As for how it will sort, think about it... With the ability to recognize which item should come first, you have the ability to create a sorting program. The actual algorithm itself is different for different sorting techniques, but the dependency on the ability to compare is common.
Henry