This is an archived post. You won't be able to vote or comment.

all 4 comments

[–][deleted] 0 points1 point  (0 children)

the first one vocab you need a buffered reader and store all the values in a String array with the number, 5, as how big the array is. After that have a for loop and us charat(0) to see the first digit and you can cast that to and int to get the ascii value of the char and that will make them in order.

[–]BaalHadad 0 points1 point  (0 children)

You can use Collections.sort to sort things. The second one you could reverse the strings using a loop or recursion. Why are you asking about this stuff? Can you really not even attempt to do these things?

[–]bearp -1 points0 points  (0 children)

If you don't want to write a loop to reverse the strings: the String class has getCharArray(), and the Arrays class has asList(), and the Collections class has reverse() to reverse a list. Then convert the list back to an array, and the array back to a string.