静态方法的引用

package net.wanho.test;

import java.util.function.Function;

public class TestAbs {
    public static void main(String[] args) {
        //静态方法的引用
        Function<Double, Double> function = Math::abs;
        double b = (double) function.apply(-2.0);
        System.out.println(b);
    }
}

绝对值

posted @ 2020-06-28 09:13  技术白菜  阅读(208)  评论(0编辑  收藏  举报