String
is a final class and cannot be extended. Additionally, for the case you seem to be interested in, you do not need the extends keyword. List
will do what you seem to want. That will allow Strings and sub-classes of String (if such a thing could exist, which it can't since String is final).