123456789101112131415161718192021222324252627282930 |
- package J20250721;
- /**
- * @author WanJl
- * @version 1.0
- * @title MySupplier
- * @description
- * @create 2025/7/21
- */
- @FunctionalInterface //标注这个接口是函数式接口
- public interface MySupplier {
- String get();
- }
- interface TriFunction{
- int get(int a,int b,int c);
- }
- class MyTest{
- public static void main(String[] args) {
- TriFunction t1=(a,b,c)-> a*b*c;
- TriFunction t2=(a,b,c)-> a+b+c;
- TriFunction t3=(a,b,c)-> a+b-c;
- int r1 = t1.get(15, 6, 7);
- int r2 = t2.get(15, 6, 7);
- int r3 = t3.get(15, 6, 7);
- System.out.println(r1);
- System.out.println(r2);
- System.out.println(r3);
- }
- }
|