泛型练习1(from李兴华)
来源:互联网 发布:中日友好靠韩国 知乎 编辑:程序博客网 时间:2024/03/29 18:50
package test.arithmetic;public class Arithmetic1 {/** * @param args */public static void main(String[] args) {Point<String> p=new Point<String>();p.setX("180度");p.setY("30度");System.out.println(p);Point<Integer> p1=new Point<Integer>();p1.setX(10);p1.setY(20);System.out.println(p1);Point<Double> p2=new Point<Double>(20d,40d);System.out.println(p2);Notepad<String,String> n=new Notepad<String,String>();n.setKey("Key");n.setValue("value");System.out.println("key:"+n.getKey()+"\t value:"+n.getValue());}}class Point<T>{private T x;private T y;public Point() {}public Point(T x, T y) {super();this.x = x;this.y = y;}public T getX() {return x;}public void setX(T x) {this.x = x;}public T getY() {return y;}public void setY(T y) {this.y = y;}@Overridepublic String toString() {return "x坐标:"+x+" \t y坐标:"+y+" \t 类型:"+x.getClass();}}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;}}
0 0
- 泛型练习1(from李兴华)
- 泛型练习1
- MYSQL练习-3(from--内连接笛卡尔积)
- 【LeetCode算法练习(C++)】Remove Duplicates from Sorted Array
- //2.11练习.练习5(1).p37
- //2.11练习.练习7(1).p37
- 算法练习1:Take every 2nd char from the string. Then the other chars 随笔
- 机器学习一小步:Kaggle上的练习Titanic: Machine Learning from Disaster(一)
- 机器学习一小步:Kaggle上的练习Titanic: Machine Learning from Disaster(二)
- 【LeetCode算法练习(C++)】Remove Nth Node From End of List
- 英语练习Where's Chen from
- CF练习赛130719 - from lanshui_Yang
- 最长上升子序列练习 - from lanshui_Yang
- SQLZOO 练习答案 SELECT FROM world
- 泛型练习4(接口)
- 泛型练习6(方法)
- 泛型练习2
- 泛型练习3
- MySQL常用命令用法总结
- 网站权限设计实现——套用JQuery EasyUI列表显示数据、分页、查询
- 符合国家快递给他盾更多更快对方沟通的更好的感觉大家分工
- 我为什么使用CSDN
- 『IOS』ios8中的UIScreen
- 泛型练习1(from李兴华)
- postgre表空间管理
- TeamViewer
- Beginning Python From Novice to Professional (4) - 字符串格式示例
- JVM源码分析-Java运行
- 校园助手APP--腾讯地图的集成使用(含街景)
- 一段有关List下集合性能的实验+JDK下源码
- Random 不重复
- Tomcat 报错的解决方法:The APR based Apache Tomcat Native library which allows optimal