Lambda is a new feature after JDK1.8, and I note that there was a problem when I first used lambda
The author USES versions: MyEclipse8.5, JDK1.8.0, and IDEA2018.2.5
When I run the following lambda code on MyEclipse, an error message appears:
The author USES versions: MyEclipse8.5, JDK1.8.0, and IDEA2018.2.5
When I run the following lambda code on MyEclipse, an error message appears:
package com.text;
public class Lambda {
public static void main(String[] args) {
Lambda lambda = new Lambda();
lambda.oldRunable();
lambda.runable();
}
public void oldRunable() {
new Thread(new Runnable() {
public void run() {
System.out.println("The old runable now is using!");
}
}).start();
}
public void runable() {
new Thread(()->System.out.println("It's a lambda function!")).start();
}
}
Code line 19 reports an error:
Multiple markers at this line
- Syntax error on tokens, Expression expected instead
- Syntax error on token(s), misplaced construct (s)
After a search on the Internet, there was no explanation for this anomaly, and then I decided to run IDEA for a try. It turned out that the same code IDEA was not wrong, so this is for record
The author estimates that it may be because the version of MyEclipse8.5 is too low, but the author has not changed the version of MyEclipse, and I will try it again in the future. You are welcome to comment on the upgraded version, thank you
Read More:
- How to Fix Warning: Statement lambda can be replaced with expression lambda
- Error: (44,73) lambda expression and XML are not supported in Java: – source 1.7 Error:java : Compilation failed
- Syntax error on tokens, delete these tokens
- Syntax Error: SassError: Invalid CSS after “…-height: #{math“: expected expression (e.g. 1px, bold
- The use of C + + template function and lambda expression
- Expected primary expression before ‘unsigned’ solution
- C code compilation_ Error: expected expression before ‘Int’
- Syntax error, syntax expected name
- error Expected an assignment or function call and instead saw an expression
- syntax error on token “catch”,Identifier expected
- Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and co
- error C2057: expected constant expression (Can the size of an array in C language be defined when the program is running?)
- Error handling response: Error: Syntax error, unrecognized expression: .c-container /deep/ .c-contai
- Syntax error on token “eat”, identifier expected after this token
- Syntax error, insert “Finally” to complete TryStatem in Myeclipse in Java-
- Lambda set to map duplicate key error solution
- Solve the Java “syntax error on token enum” problem
- Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the
- Eclipse .java File Syntax error, parameterized types are only available if source level is 1.5 or