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