int getValue()
描述 (Description)
java.time.Year.getValue()方法获取年份值。
声明 (Declaration)
以下是java.time.Year.getValue()方法的声明。
public int getValue()
返回值 (Return Value)
年份,从MIN_YEAR到MAX_YEAR。
例子 (Example)
以下示例显示了java.time.Year.getValue()方法的用法。
package com.iowiki;
import java.time.Year;
public class YearDemo {
public static void main(String[] args) {
Year date = Year.of(2017);
System.out.println(date.getValue());
}
}
让我们编译并运行上面的程序,这将产生以下结果 -
2017