【泛型】接口上定义泛型

来源:互联网 发布:广东11选5数据360遗漏 编辑:程序博客网 时间:2024/06/05 12:47
//接口上定义泛型
package fx;
import java.util.*;
interface testfxjk1<E>
{
public abstract void show(E e);
public abstract void fun(String ss);
}
class testfxjk2 implements testfxjk1<Integer>//在类上的泛型确定了接口上的泛型才能确定
{
public void show(Integer e)
{
}
public void fun(String ss)
{

}
}
class testfxjk3<E> implements testfxjk1<E>
{
public void show(E e)
{

}public void fun(String ss)
{

}
}
public class TestFXInterface {
public static void main(String[] args) {
testfxjk3<String> test=new testfxjk3<String>();
test.show("hello");
}


}
0 0