Reputation: 1648
In one method I have
public abstract <T extends QuestionsVO> T toBean(String json);
Similarly I want to make another method like
public abstract String toJson(Object<? extends QuestionsVO> questionImplementation);
but second method give me error. I want to pass only those class as parameter which are subclass of QuestionVO class
How can I do it
Upvotes: 1
Views: 52
Reputation: 2155
This should work with any subclass of QuestionsVO :
public abstract String toJson (QuestionsVO questionImplementation);
Upvotes: 1
Reputation: 62854
The first method definition already gives the hint:
public abstract <T extends QuestionsVO> String toJson(T questionImplementation);
Upvotes: 5