Problem overriding ArrayList add method

前端 未结 7 1903
一整个雨季
一整个雨季 2021-01-27 19:45

I have a class that is extending Java\'s ArrayList. I\'m currently using Java build 1.6.0_22-b04. Looks like this:

public class TokenSequence extends ArrayList&         


        
7条回答
  •  情深已故
    2021-01-27 20:39

    The error message already provided a large hint here.

    I haven't tried it, but I believe the correct implementation would be:

    public void add(Token o) {
    }
    

    because Token is the E in your extends statement.

提交回复
热议问题