13,100
社区成员
发帖
与我相关
我的任务
分享
//范型接口
public interface ITask <T>{
public String execute(T x) throws Exception;
}
//实现类,希望在接口和方法中指定一种类型,如TestObj
public class CustomerDetail implements ITask <TestObj>{
public String execute(TestObj x) throws Exception {
//业务处理代码
return null;
}
//希望能够避免这种情况
public class CustomerDetail implements ITask{
public String execute(Object x) throws Exception {
// TODO Auto-generated method stub
return null;
}
}