为什么这个程序报错 LocalDate cannot be resolved to a type?

代码是

import java.time.LocalDate;
 public class TodayDate {
        public static void main(String[] args) {
            LocalDate today=LocalDate.now();
        System.out.println(today);
        }
    }

错误是

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
LocalDate cannot be resolved to a type
LocalDate cannot be resolved
at TodayDate.main(TodayDate.java:5)

我用的是jdk11,eslipse也是18年9月的,应该不是版本问题吧?

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!