摘要: //创建点对象class Point{ private int x; private int y; Point(int x,int y){ this.x = x; this.y = y; } public int getX(){ return x; } public int getY(){ retu 阅读全文
posted @ 2017-05-10 18:01 FallenLunatic 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 需求:定义一个User类,提供name,age字段,以及相应getter/setter方法。 并创建对象,设置name和age数据,在打印对象的name,age。 什么是this: 表示当前对象,什么又是当前对象 this只要存在于两个位置: 构造器中:就表示当前创建的对象 方法中:哪一个对象调用t 阅读全文
posted @ 2017-05-10 17:55 FallenLunatic 阅读(134) 评论(0) 推荐(0) 编辑