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

