2013年3月21日
摘要:
class Circle {double radius;Circle(double r){radius=r;}double computerArea(){return 3.14*radius*radius;}void setRadius(double newRadius){radius=newRadius;}double getRadius(){return radius;}}class Cone{Circle bottom;double height;Cone(Circle c,double h){bottom=c;height=h;}double computerVolume(){doub 阅读全文
posted @ 2013-03-21 22:49
张思宇
阅读(256)
评论(0)
推荐(0)
摘要:
1、向一个方法的基本数据类型参数传值class Tom {void f(int x,double y){x=x+1;y=y+1;System.out.printf("参数x和y的值分别是:%d,%3.2f\n",x,y);}}public class example4_7{public static void main(String args[]){int x=10;double y=12.58;Tom cat=new Tom();cat.f(x,y);System.out.printf("main方法中x和y的值仍然分别是:%d,%3.2f\n",x, 阅读全文
posted @ 2013-03-21 22:24
张思宇
阅读(472)
评论(0)
推荐(0)
摘要:
class Computer {double x,y;static double max(double a,double b){return a>b?a:b;}}class example4_6{public static void main(String args[]){double max=Computer.max(12,45);System.out.println(max);}} 阅读全文
posted @ 2013-03-21 21:49
张思宇
阅读(478)
评论(0)
推荐(0)
摘要:
class Tom{final int MAX=100;static final int MIN=20;}public class example4_5{public static void main(String args[]){System.out.println(Tom.MIN);Tom cat=new Tom();int x=0;x=Tom.MIN+cat.MAX;System.out.println(x);}} 阅读全文
posted @ 2013-03-21 20:43
张思宇
阅读(208)
评论(0)
推荐(0)
摘要:
class Lader{double above ,height;static double bottom;void setAbove(double a){above=a;}void setBottom(double b){bottom=b;}double getAbove(){return above;}double getBottom(){return bottom;}}class example4_4 {public static void main(String arg[]){Lader.bottom=60;Lader laderOne,laderTwo;System.out.prin 阅读全文
posted @ 2013-03-21 20:19
张思宇
阅读(385)
评论(0)
推荐(0)
摘要:
class Lader {double above,bottom,height;Lader(){}Lader(double a,double b,double h){above=a;bottom=b;height=h;}public void setAbove(double a){above=a;}public void setBottom(double b){bottom=b;}public void setHeight(double h){height=h;}double computeArea(){return (above+bottom)*height/2.0;}}public cla 阅读全文
posted @ 2013-03-21 20:17
张思宇
阅读(1020)
评论(0)
推荐(0)
浙公网安备 33010602011771号