集册 Java实例教程 使用日历显示月份

使用日历显示月份

欢马劈雪     最近更新时间:2020-01-02 10:19:05

427
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
使用日历显示月份

 

import java.util.Calendar;


public class Main {// 来 自 N o  w  J a v a . c o m - 时  代  Java


  public static void main(String[] args) {

    Calendar now = Calendar.getInstance();


    System.out.println("Current date : " + (now.get(Calendar.MONTH) + 1) + "-" + now.get(Calendar.DATE) + "-"

        + now.get(Calendar.YEAR));


    String[] strMonths = new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",

        
展开阅读全文