日期:2014-05-20  浏览次数:20614 次

如何写一个泛型类继承非泛型接口??搜了一下,论坛上讨论泛型的似乎特别的少。
比如说一个接口

interface   List{
        public   boolean   empty();
        public   void   append(Object   o);
        public   Object   getElement(int   index);
        public   void   delet(int   index);
}

如何写一个泛型的类去继承这个接口??

谢谢大家

------解决方案--------------------
仅限于5.0 (JDK1.5)
package testGenType;

public interface TestInterface {

public boolean empty();

}

package testGenType;

public class TestClass <T> implements TestInterface
{

/**
* @param args
*/

public static void main(String[] args) {
// TODO 自动生成方法存根
TestInterface tInterface = new TestClass <String> ();
System.out.println(tInterface.empty());

}
public boolean empty(){return true;}

}

貌似JDK6.0不支持这么写。