Sort Game in arrays challenges

how to approach to this question as how can i sort both string and number in an array?

Hi @himanshukumarclassic37.hk, in this question what you can do is you can make two arrays one of string and one for salary and you have to arrange the salary in decreasing order but if two salaries will become equal you will check for strings(ie arrange them in lexicographic order) in the array of strings and do this until u reach the end of the arrays and then display the arrays.

but how can i sort the strings in lexicographical manner??

you can compare the two strings simply like if(str2.compareto(str1) <0)then swap the strings else do nothing.This compare to function works as if string2 is smaller than the first string then it will give ans as less than zero,if the two srings are equal then ans is equal to zero else if string 2 is greater than string 1 then the ans >0.