Java 泛型定义在接口上
2016-04-21 15:50
711 查看
//泛型定义在接口上。 interface Inter<T> { void show(T t); } /* class InterImpl implements Inter<String> { public void show(String t) { System.out.println("show :"+t); } } */ class InterImpl<T> implements Inter<T> { public void show(T t) { System.out.println("show :"+t); } } class GenericDemo5 { public static void main(String[] args) { InterImpl<Integer> i = new InterImpl<Integer>(); i.show(4); //InterImpl i = new InterImpl(); //i.show("haha"); } }
————摘自《毕向东25天》
相关文章推荐
- jackson、Gson反序列化 泛型
- JAVA泛型—— 3fe8 转
- JAVA泛型详解——转
- 编写高质量代码改善C#程序――使用泛型集合代替非泛型集合(建议20)
- 简单学习C#中的泛型方法使用
- C#通过反射创建自定义泛型
- C#泛型用法实例分析
- C语言泛型编程实例教程
- C# 泛型的简单理解(安全、集合、方法、约束、继承)分享
- C#泛型Dictionary的用法实例详解
- C#泛型和反射实例解析
- C#泛型实例详解
- .NET开发基础:从简单的例子理解泛型 分享
- RadioButtonList绑定图片及泛型Dictionary应用
- Swift编程中的泛型解析
- C#实现利用泛型将DataSet转为Model的方法
- 关于C#泛型列表List<T>的基本用法总结
- 详解C#中的泛型以及编程中使用泛型的优点
- list泛型自定义排序示例
- .NET基础之自定义泛型分析