I have an interface which just contains one generic method:
public interface Presenter {
<T> void query(T queryParameter);
}
Now, I want to define a subclass of Presenter
and I want the type to be String
, just like this:
public class IpQueryPresenter implements Presenter {
void query(String queryParameter) {
//do something here...
}
}
How to define it ?
I saw all your answers define the type on the interface name, but is it a must ? Is it possible if I just want to define a generic method and override it ?