In: Computer Science
Write a program that uses a for loop to print
One of the months of the year is January
One of the months of the year is February
...
//class definition
public class months {
//main function definition
public static void main(String[] args) {
//define string array and
initialize it with names of 12 months
String[] months
={"January","February","March","April","May","June","July","August","September","October","November","December"
};
//for loop to print desired
result
//each iteration will print a line
for a month
for (int i=0;i<12;i++){
System.out.println("One
of the months of the year is "+ months[i]);
}
}
}