champinder89
2009-03-27 12:08:49 UTC
THe array in my program consists of 7 days of the week
String strs[] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" , "Saturday", "Sunday" };
I want the output which reads Sunday, saturday, friday, thursday, wednesday, tuesday, monday
below is the scratch code plzzz feel free to edit thanks in advance!!!!
import java.util.*;
public class Problem5 {
public static void main(String args[]) {
String days[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday" , "Saturday", "Sunday" };
System.out.print("Initial order: ");
for(String s : days)
System.out.print(s + " ");
System.out.println("\n");
Arrays.sort(days);
System.out.print("Sorted in reverse order: ");
for(String s : days)
System.out.print(s + " ");
System.out.println("\n");
}
}