可以使用Java中的Calendar类来获取当前年度,示例代码如下:

import java.util.Calendar;

public class Main {
    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        int year = calendar.get(Calendar.YEAR);
        System.out.println("当前年度为:" + year);
    }
}

运行结果:

当前年度为:2021
java 获取当前年度

原文地址: https://www.cveoy.top/t/topic/eGJt 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录