java.time.Year.isAfter(Year other)
方法檢查此年-月是否在指定年份之後。
聲明
以下是java.time.Year.isAfter(Year other)
方法的聲明。
public boolean isAfter(Year other)
參數
other
- 比較的另一年,而不是null
。
返回值
如果此年份是在指定年份之後,則為true
。
示例
以下示例顯示了java.time.Year.isAfter(Year other)
方法的用法。
package com.zaixian;
import java.time.Year;
public class YearDemo {
public static void main(String[] args) {
Year date = Year.of(2016);
Year date1 = Year.of(2017);
System.out.println(date1.isAfter(date));
}
}
編譯並運行上面的程式,這將產生以下結果 -
true
上一篇:
java.time.Year類
下一篇:
java.time.YearMonth類