Java“此语言级别不支持 lambda 表达式" [英] Java "lambda expressions not supported at this language level"
问题描述
我正在测试 Java 8 的一些新功能并将示例复制到我的 IDE(最初是 Eclipse,然后是 IntelliJ)中,如图
I was testing out some new features of Java 8 and copied the example into my IDE (Eclipse originally, then IntelliJ) as shown here
Eclipse offered no support whatsoever for lambda expressions, and IntelliJ kept reporting an error
Lambda expressions not supported at this language level
I would like to know if this is a problem with my install, the code, or support.
In IntelliJ IDEA:
In File Menu
→ Project Structure
→ Project
, change Project Language Level
to 8.0 - Lambdas, type annotations etc.
For Android 3.0+ Go File
→ Project Structure
→ Module
→ app
and In Properties Tab set Source Compatibility
and Target Compatibility
to 1.8 (Java 8)
Screenshot:
这篇关于Java“此语言级别不支持 lambda 表达式"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!