java 设置多个泛型类型
2012-03-14 19:34
465 查看
class NotePad<K,V>{ private K key; private V value; public K getKey() { return key; } public void setKey(K key) { this.key = key; } public V getValue() { return value; } public void setValue(V value) { this.value = value; } } public class dsadas { public static void main(String args[]){ Notepad<String,Integer> t=new Notepad<String ,Integer>(); t.setKey("李兴华"); t.setValue(30); System.out.println("Name:"+t.getKey()); System.out.println("Age:"+t.getValue()); } }
相关文章推荐
- java 设置多个泛型类型
- java_泛型,设置类型通配符的上限
- Java语法糖的味道:泛型与类型擦除
- 掌握 Java 泛型类型(四)
- Java基础(21):泛型—泛型的定义、用法与类型通配符的使用方式
- ParameterizedType获取java泛型参数类型
- Java获取泛型参数的类型的方法 .
- 如何获取java中泛型参数的实际类型--反射获取
- The Java™ Tutorials — Generics :Generic Methods and Bounded Type Parameters 泛型方法和受限类型参数
- [疯狂Java]泛型:泛型方法、泛型方法VS类型通配符(?)
- 获取java泛型参数类型
- Java的泛型是类型擦除的
- java中通过反射获取泛型的参数类型
- Java获得泛型类型
- Java,泛型类型通配符和C#对比
- java 设置嵌套泛型
- Java 5.0泛型编程之泛型类型(2)
- 泛型--Java使用泛型编程提取类名上T类型
- Java子类中获取继承时传入泛型的类型
- [编写高质量代码:改善java程序的151个建议]建议93 JAVA的泛型类型是擦除的