Hierarchy of characters in compareTo() function of java

Brendan :

I am new here so I don't know much whether there are any sections for different questions and the like. So sorry for that in advance.

So, my question is, can anyone tell me the hierarchy of characters or rather strings in compareTo() function of java. In this code...

String s1 = "HELLO";
String s2 = "hello";
int c;
c = s1.compareTo(s2);
System.out.println(c);

In here, the output is -32, which means 'H' is smaller than 'h'. So I would like to know the list in which the characters are arranged from highest to the lowest value. Thanks in advance.

Erik McKelvey :

The compareTo() method uses Unicode values to compare the strings. A full list can be found here: https://en.wikipedia.org/wiki/List_of_Unicode_characters

It could be useful to look up Unicode values on google images for a chart.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=396532&siteId=1