代码如下
public class TestOfDemoNoneName {
public static void main(String[] args) {
sptNum("林青霞,30" , s -> Integer.parseInt(s.split(",")[1] , xx->xx+70));
}
private static void sptNum(String s, Function<String,Integer> e,Function<Integer,Integer> add){
Integer ok = e.andThen(add).apply(s);
System.out.println(ok);
}
}
代码及其
运行截图
sptNum("林青霞,30" , s -> Integer.parseInt(s.split(",")[1] , xx->xx+70));
代码有误,[1]
后面少了一个 )
,xx+70))
多了一个 )
,修改后的代码如下:
public class TestOfDemoNoneName {
public static void main(String[] args) {
sptNum("林青霞,30", s -> Integer.parseInt(s.split(",")[1]), xx -> xx + 70);
}
private static void sptNum(String s, Function<String, Integer> e, Function<Integer, Integer> add) {
Integer ok = e.andThen(add).apply(s);
System.out.println(ok);
}
}