Affichier les mois de l’année

Author:


Download

 
import java.util.Calendar;
 
public class MoisAnnee {
  public static void main(String[] args) {
    Calendar maintenant = Calendar.getInstance();
 
    System.out.println("Date complete : " + (maintenant.get(Calendar.MONTH) + 1) + "-"
        + maintenant.get(Calendar.DATE) + "-" + maintenant.get(Calendar.YEAR));
 
    String[] nomMois = new String[] { "Jan", "Fev", "Mar", "Avr", "Mai", "Juin", "Jul", "Aoû",
        "Sep", "Oct", "Nov", "Dec" };
    System.out.println("La date courante est : " + nomMois[maintenant.get(Calendar.MONTH)]);
 
  }
 
}