函数式接口Supplier
package it.com.cc.sixtween;
import java.util.function.Supplier;
public class SupplierDemo {
public static void main(String[] args) {
String s=getString(()->"林青霞");
System.out.println(s);
String w=getString(()->"林青霞1");
System.out.println(w);
Integer i=getInteger(()->30);
System.out.println(i);
Integer o=getInteger(()->20);
System.out.println(o);
}
private static String getString(Supplier<String> sup){
return sup.get();
}
private static Integer getInteger(Supplier<Integer> sup){
return sup.get();
}
}