MySupplier.java 678 B

123456789101112131415161718192021222324252627282930
  1. package J20250721;
  2. /**
  3. * @author WanJl
  4. * @version 1.0
  5. * @title MySupplier
  6. * @description
  7. * @create 2025/7/21
  8. */
  9. @FunctionalInterface //标注这个接口是函数式接口
  10. public interface MySupplier {
  11. String get();
  12. }
  13. interface TriFunction{
  14. int get(int a,int b,int c);
  15. }
  16. class MyTest{
  17. public static void main(String[] args) {
  18. TriFunction t1=(a,b,c)-> a*b*c;
  19. TriFunction t2=(a,b,c)-> a+b+c;
  20. TriFunction t3=(a,b,c)-> a+b-c;
  21. int r1 = t1.get(15, 6, 7);
  22. int r2 = t2.get(15, 6, 7);
  23. int r3 = t3.get(15, 6, 7);
  24. System.out.println(r1);
  25. System.out.println(r2);
  26. System.out.println(r3);
  27. }
  28. }