I have a class which is supposed to work by definition only with a String parameter.
So I thought about using
class MyClass<T extends String>
But then the compiler gives a warning that string is final and I can't extend it
Tried then with
class MyClass<String>
And got a warning because the parameter String is hiding class String.
What do I have to do?
String. You are not creating a type parameter which is limited toStrings. In fact, the type parameter in your second example could have any value.