admin管理员组文章数量:1636897
intellij提示如下:
Class 'Anonymous class derived from Function2' must either be declared abstract or implement abstract method 'call(T1, T2)' in 'Function2'
结局方案:
private static Function2 <String, Long,Long> func2=new Function2<String,Long,Long>() { private static final long serialVersionUID = 1L; public Long call(Long v1, Long v2) throws Exception { return v1+v2; } };
改成:
private static Function2 <Long, Long,Long> func2=new Function2<Long,Long,Long>() { private static final long serialVersionUID = 1L; public Long call(Long v1, Long v2) throws Exception { return v1+v2; } };
原因:
入口参数如果是String和Long的话,call函数中就不存在两个Long变量了。
也就是变量类型不匹配的问题。
本文标签: abstractimplementxxxdeclaredmethod
版权声明:本文标题:xxx must either be declared abstract or implement abstract method ‘call(T1, T2)‘ in ‘Function2 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1729233089a1191676.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论