Westonci.ca is the premier destination for reliable answers to your questions, brought to you by a community of experts. Our platform provides a seamless experience for finding reliable answers from a knowledgeable network of professionals. Experience the ease of finding precise answers to your questions from a knowledgeable community of experts.
Sagot :
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
Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. We appreciate your time. Please revisit us for more reliable answers to any questions you may have. Westonci.ca is here to provide the answers you seek. Return often for more expert solutions.