代码
提交代码
import java.util.function.Supplier; public class DemoSupplier { public static void main(String[] args) { String sA = "Hello "; String sB = "World "; System.out.println( getString( () -> sA + sB ) ); } private static String getString(Supplier<String> stringSupplier) { return stringSupplier.get(); } }
运行结果