package jp.co.bbreak.sokusen._2._2;
public class LocalDateTimeSample {
public static <OffsetDateTime, ZonedDataTime> void main(String[] args){
//時差を持たない日時を取得
LocalDateTimeSample localDateTime = LocalDateTimeSample.now();
System.out.println(localDateTime);
Object ZoneOffset; //時差を加味した日時を生成 OffsetDateTime offsetDateTime = OffsetDateTime.of( 2020,Math.APRIL.getValue(),8,10,20,30,0, ((Object) ZoneOffset).of("+09:00")); System.out.println(offsetDateTime); //時差/地域情報を加味した日時を生成 ZonedDataTime zonedDateTime = ((Object) zonedDateTime).parse( "2025-07-24T11:12+09:00[Asia/Tokyo"); System.out.println(zonedDateTime); } private static LocalDateTimeSample now() { // TODO 自動生成されたメソッド・スタブ return null; }
}
これを実行すると、コンソールに以下のようなエラーが出ます。
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
APRIL は解決できないか、フィールドではありません
メソッド of(String) は型 Object で未定義です
メソッド parse(String) は型 Object で未定義です
at jp.co.bbreak.sokusen._2._2.LocalDateTimeSample.main(LocalDateTimeSample.java:14)
解決方法を教えていただきたいです。
回答1件
あなたの回答
tips
プレビュー