Skip to content

Commit

Permalink
lambda9__Lambda省略格式
Browse files Browse the repository at this point in the history
  • Loading branch information
CPU-Code committed Sep 15, 2020
1 parent 26c3497 commit 509f168
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
32 changes: 32 additions & 0 deletions Lambda/lambda9.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* @由于个人水平有限, 难免有些错误, 还请指点:
* @Author: cpu_code
* @Date: 2020-09-15 20:40:44
* @LastEditTime: 2020-09-15 20:44:59
* @FilePath: \java\Lambda\lambda9.java
* @Gitee: [https://gitee.com/cpu_code](https://gitee.com/cpu_code)
* @Github: [https://github.com/CPU-Code](https://github.com/CPU-Code)
* @CSDN: [https://blog.csdn.net/qq_44226094](https://blog.csdn.net/qq_44226094)
* @Gitbook: [https://923992029.gitbook.io/cpucode/](https://923992029.gitbook.io/cpucode/)
*/
package Lambda;

public class lambda9 {
public static void main(String[] args){
invokeCalc(() -> System.out.println("吃饭"));
}

private static void invokeCalc(Cook cook){
cook.makeFood();
}
}

/* 使用Lambda必须具有接口,且要求接口中有且仅有一个抽象方法 */

interface Cook{
void makeFood();
}

/*
吃饭
*/
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @由于个人水平有限, 难免有些错误, 还请指点:
* @Author: cpu_code
* @Date: 2020-07-12 12:03:11
* @LastEditTime: 2020-09-15 20:32:14
* @LastEditTime: 2020-09-15 20:45:24
* @FilePath: \java\README.md
* @Gitee: [https://gitee.com/cpu_code](https://gitee.com/cpu_code)
* @Github: [https://github.com/CPU-Code](https://github.com/CPU-Code)
Expand Down Expand Up @@ -306,7 +306,8 @@ java编程基础 面向对象 javaAPI 集合 IO GUI JD8C 多线程 网络编程
- [x] [lambda5__Lambda标准格式的无参无返回](Lambda/lambda5.java)
- [x] [lambda6__Lambda的参数和返回值](Lambda/lambda6.java)
- [x] [lambda7__Lambda写法](Lambda/lambda7.java)
- [ ] [lambda8__Lambda标准格式的有参有返回](Lambda/lambda8.java)
- [x] [lambda8__Lambda标准格式的有参有返回](Lambda/lambda8.java)
- [x] [lambda9__Lambda省略格式](Lambda/lambda9.java)

-----------

Expand Down

0 comments on commit 509f168

Please sign in to comment.