⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.java

📁 java的经典例子
💻 JAVA
字号:
import java.util.*;

class Main {
    public static void main(String[] args) {
        Calendar cal = Calendar.getInstance();
        cal.setTimeZone(TimeZone.getTimeZone("GMT"));

        // Is midnight am or pm?
        cal.setTime(new Date(0));
        System.out.println(cal.get(Calendar.AM_PM));    // 0        <AM>

        // A millisecond before midnight?
        cal.setTime(new Date(-1));
        System.out.println(cal.get(Calendar.AM_PM));    // 1        <PM>

        // How about noon?
        cal.setTime(new Date(12*60*60*1000));
        System.out.println(cal.get(Calendar.AM_PM));    // 1        <PM>

        // Add 12 hours to the current time.
        cal = Calendar.getInstance();
        System.out.println(cal.get(Calendar.AM_PM));    // 0        <AM>
        cal.add(Calendar.HOUR, 12);
        System.out.println(cal.get(Calendar.AM_PM));    // 1        <PM>
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -