相关文章推荐
安静的领带  ·  Primer designing tool·  6 月前    · 
越狱的泡面  ·  apple Xcode ...·  1 年前    · 
火爆的春卷  ·  ElFinder与CodeIgniter ...·  2 年前    · 

I have the following interface:

public interface SingleRecordInterface {

public void insert(T object);

}

I have the abstract class below (that does not mention the method insert):

public abstract class AbstractEntry implements SingleRecordInterface {

}

I have the concrete class:

public class SpecificEntry extends AbstractEntry {

public void insert(SpecificEntryBean entry) {

// stuff

}

}

Finally, SpecificEntryBean is defined as:

public class SpecificEntryBean extends AbstractEntryBean {

}

I have the following error:

The type SpecificEntry must implement the inherited abstract method SingleRecordInterface.insert(AbstractEntryBean)

I don't understand the reason for this error, given that SpecificEntryBean extends AbstractEntryBean. How do I fix this error?

解决方案

You need to make your abstract class generic as well:

public abstract class AbstractEntry implements SingleRecordInterface {

}

Then for your concrete class:

public class SpecificEntry extends AbstractEntry {

}

版权声明:本文为CSDN博主「weixin_26886855」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接: https://blog.csdn.net/weixin_26886855/article/details/118828409