public static void main(String[] args) { // TODO Auto-generated method stub //函数式接口 Function<Integer, String[]> f=x->new String[x]; String[] strs=f.apply(10); System.out.println(strs.length); //10 Runnable r=()->System.out.println("Runnable接口"); r.run(); //Runnable接口 Supplier<Integer> s=()->{ Integer i=100; //..... return i; }; System.out.println(s.get()); //100 Consumer<Double> c=d->{ System.out.println(d); }; c.accept(100.001); //100.001 BiConsumer<Integer,String[]> b=(a,st)->{ System.out.println(a); for(int i=0;i<st.length;i++){ st[i]=st[i].toUpperCase(); System.out.print(st[i]+" "); } System.out.println(); }; String[] sts=new String[]{"hello","world"}; b.accept(99, sts); //HELLO WORLD BiFunction<Integer, Double, String> bi=(one,second)->{ String sone=""+one+second; return sone; }; System.out.println(bi.apply(123, 456.789)); //123456.789 }