java.time.Month.getValue() 方法
描述
java.time.Month.getValue() 方法获取月份 int 值。
声明
以下是 java.time.Month.getValue() 方法的声明。
public int getValue()
返回值
一年中的月份,从 1(一月)到 12(十二月)。
示例
下面的例子展示了 java.time.Month.getValue() 方法的使用。
package com.tutorialspoint;
import java.time.Month;
public class MonthDemo {
public static void main(String[] args) {
Month month = Month.FEBRUARY;
System.out.println(month.getValue());
}
}
让我们编译并运行上面的程序,这将产生下面的结果 −
2

