Sort in ascending and descending order by length of the given array of strings

EASY JAVA

Write a Java program to sort in ascending and descending order by length of the given array of strings.
Your Input :
[Green, White, Black, Pink, Orange, Blue, Champagne, Indigo, Ivory]

Your output should have the descending order first, then ascending order on separate lines.


Submit Answer

NOTE These questions can be solved in either Java , Python , Rust, C++, Go or ! However, the language intended for these questions is mentioned along with the question on the top. You need to submit the solution file for the autograder to grade the submission. If you are submitting in Java, make sure that the class name is Main (with a capital M)


Optional Java Editor for your use