- class FanXingDemo implements FanXingInter<String>,FanXingInter<Integer>
- {
- public static void main(String[] args)
- {
- FanXingDemo f = new FanXingDemo();
- f.show("Hello");
- f.show(5);
- }
- public void show(String str){
- System.out.println(str);
- }
- public void show(Integer i){
- System.out.println(i);
- }
- }
- interface FanXingInter<T>
- {
- void show(T t);
- }
复制代码 程序报 接口重复 错误,FanXingInter<String>和FanXingInter<Integer> 是一样的? 分开实现就可以,但是这样就要多写一个类...
|