Java Program to print the Month Name
Demonstrate array operation using Month Name display program in Java
Program
public class MonthNameDisplay
{
static String months[] =
{
null , "January" , "February" , "March" , "April", "May",
"June", "July", "August", "September", "October",
"November", "December"
};
public static void main( String[] args )
{
int m = Integer.parseInt( args[0] );
System.out.println( months[ m ] );
}
}
Output
java MonthNameDisplay 2
February