麻烦问一下大家,在java中如何定义一个接口   我用list查询出数据库中所有的数据  接口应该怎么写?

解决方案 »

  1.   

    public interface xx<T>{   public List<T> getXxxs();
    }
    就好了,你是用实现什么,说清楚,不可就定义一个接口呀
      

  2.   


    public interface SampleService { public List getAllData();//这个就是获取数据的接口,如果需要传参数的话,则直接写在括号内}
      

  3.   

    public interface XXXXService{    public List<XXXX> getAllData() throws Exception;}
    public class XXXXServiceImpl implements XXXXService {        @Override
        public List<XXXX> getAllData() throws Exception{
             //do something ;
             //条件判断  逻辑处理
             //调用dao
        }
    基本同一楼一样