草庐IT

plusHours

全部标签

尽管在 Oracle 教程示例代码中显示,Java 8 Instant 类没有 plusHours 方法

OracleTutorialpagefortheInstantclass显示此示例代码:InstantoneHourLater=Instant.now().plusHours(1);当我尝试编译这段代码时,编译器会抛出错误:错误InstantPrint.java:6:error:cannotfindsymbolInstantoneHourLater=Instant.now().plusHours(1);^symbol:methodplusHours(int)location:classInstant但是这个Java文档提到了plusHours()方法,但是我检查了这个Instant类并

尽管在 Oracle 教程示例代码中显示,Java 8 Instant 类没有 plusHours 方法

OracleTutorialpagefortheInstantclass显示此示例代码:InstantoneHourLater=Instant.now().plusHours(1);当我尝试编译这段代码时,编译器会抛出错误:错误InstantPrint.java:6:error:cannotfindsymbolInstantoneHourLater=Instant.now().plusHours(1);^symbol:methodplusHours(int)location:classInstant但是这个Java文档提到了plusHours()方法,但是我检查了这个Instant类并