I wrote this code, but I want to know how to alphabetize the monthsusing the com
ID: 3618226 • Letter: I
Question
I wrote this code, but I want to know how to alphabetize the monthsusing the compareTo() method (I know this way is easier but I'dlike to know how to do it the tedious way).import java.util.*;
/**
* Write a description of class LongestMonthFinder here.
*
* @author (Alex Ramos)
* @version (4/19/10)
*/
public class Alphabetized{
public static void main(String[] args){
String[] months ={"January", "February", "March"
,"April", "May", "June", "July"
,"August", "September","October"
,"November", "December"};
Arrays.sort(months);
System.out.println(Arrays.toString(months));
}
}