我有一种方法
public abstract <T extends QuestionsVO> T toBean(String json);
同样我想做另一种方法
public abstract String toJson(Object<? extends QuestionsVO> questionImplementation);
但是第二种方法给我错误。 我只想传递那些作为参数的类,它们是 QuestionVO 类的子类
我该怎么做
最佳答案
第一个方法定义已经给出了提示:
public abstract <T extends QuestionsVO> String toJson(T questionImplementation);
关于java - 传递泛型作为方法的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30477820/