Question: Write a method, public static void sortAndPrint(String [] list), which implements a selection sort on the array list and prints the sorted values in order.

Write a method, public static void sortAndPrint(String [] list), which implements a selection sort on the array list and prints the sorted values in order. Make sure to use the String.compareTo() method when sorting to decide the correct order of the Strings. For example, consider the following code: String [] list = { "against" , "forms" , "belief" , "government" , "democratic" , "movement" , "understanding"}; sortAndPrint(list); The should print the following: against belief democratic forms government movement understanding For this activity, include your method in a class called Lesson_15_Activity. Copy the entire class into the coderunner box and press run.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!