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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started