Answer :
public class MyClass {
public static String monthName(int num){
String arr[] = {"January", "February", "March", "April", "May", "June", "July","August", "September", "October", "November", "December"};
return arr[num-1];
}
public static void main(String args[]) {
System.out.println(monthName(8));
}
}
I hope this helps.
Methods are blocks of named statements that can be called from other place in the program
The method in java, where comments are used to explain each line is as follows:
//This defines the method
public static void monthName(int month){
//This initializes the array of months
String months[] = {"January", "February", "March", "April", "May", "June", "July","August", "September", "October", "November", "December"};
//This prints the month name
System.out.print(months[month-1]); }
Read more about similar programs at:
https://brainly.com/question/22589115