Class extends Something>
Here\'s my interpretation, it\'s class template but the class ? means the name of the class is undetermined and it exte
There are a few confusing answers here so I will try and clear this up. You define a generic as such:
public class Foo {
private T t;
public void setValue(T t) {
this.t = t;
}
public T getValue() {
return t;
}
}
If you want a generic on Foo to always extend a class Bar you would declare it as such:
public class Foo {
private T t;
public void setValue(T t) {
this.t = t;
}
public T getValue() {
return t;
}
}
The ? is used when you declare a variable.
Foo extends Bar>foo = getFoo();
OR
DoSomething(List extends Bar> listOfBarObjects) {
//internals
}