Can you help me wlth the following work?:
This sample program shows how to print the current month, now using the "Calendar" object (instead of the Date object which has been deprecated, meaning it has been slated for removal from the language).
// Program prints the current month
import java.util.Calendar;
public class ShowToday {
static String[] monthArray = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
public static void main(String[] args) {
Calendar rightNow = Calendar.getInstance();
int month = rightNow.get( Calendar.MONTH );
// This will be a number from 0 to 11, representing January to December
System.out.println("month: " + month );
// Using the above array, this will print "Jan" thru "Dec"
System.out.println("month: " + monthArray[month] );
}
}
:!: