摘要: //定义一个点类Point,有两个实型点//定义一个圆类,包括一个点和一个半径,有两个构造方法分别是传入一个点和半径,和传入一个点,在圆类中可以设置点的位置//有个包含方法,判断一个点是否在圆中//返回一个点方法//返回半径方法//设置半径方法//求圆面积//定义两个圆,获取圆心和半径,面积//重新设置两个圆的点和半径//判断点是否在圆中class Point{ private double x,y; Point(double _x,double _y) { x=_x; y=_y; } public double getX() {... 阅读全文
posted @ 2013-03-28 14:57 glt66 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 1 class Person 2 { 3 private int id; 4 private int age=20; 5 Person() 6 { 7 id=0; 8 age=20; 9 }10 Person(int _id)11 {12 id=_id;13 age=23;14 }15 Person(int _id,int _age)16 {17 id=_id;18 age=_age;19 }20 pu... 阅读全文
posted @ 2013-03-28 10:33 glt66 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 1 //方法重载,max int short float 2 class Test 3 { 4 void max(int a, int b) 5 { 6 System.out.println(a>b?a:b); 7 } 8 void max(short a, short b) 9 {10 System.out.println(a>b?a:b);11 }12 void max(float a, float b)13 {14 System.out.println(a>b?a:b);15... 阅读全文
posted @ 2013-03-28 10:00 glt66 阅读(136) 评论(0) 推荐(0) 编辑