摘要: 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-20 22:19 徐慧同学 阅读(135) 评论(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 args[]){Lader.bottom=60; Lade... 阅读全文
posted @ 2013-03-20 21:43 徐慧同学 阅读(287) 评论(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)*heig 阅读全文
posted @ 2013-03-19 22:12 徐慧同学 阅读(1453) 评论(0) 推荐(0) 编辑
摘要: 例4-2class Circle{double radius;double getArea(){double area=3.14*radius*radius;return area;}}public class Example4_2{public static void main(String args[]){Circle circle;circle=new Circle();circle.radius=163.16;double area=circle.getArea();System.out.printf("半径是%5.3f的圆的面积:\n%5.3f\n",circle 阅读全文
posted @ 2013-03-19 21:49 徐慧同学 阅读(2451) 评论(0) 推荐(0) 编辑
摘要: 例4-1public class ComputerCircleArea{public static void main(String args[]){double radius;double area;radius=163.16;area=3.14*radius*radius;System.out.printf("半径是%5.3f的圆的面积:\n%5.3f\n",radius,area);}} 阅读全文
posted @ 2013-03-19 21:48 徐慧同学 阅读(418) 评论(0) 推荐(0) 编辑
摘要: 例3-4import java.util.*;public class Example3_4{public static void main(String args[]){Scanner reader=new Scanner(System.in);System.out.println("输入一个月份:");int n=reader.nextInt();switch(n){case 1:case 2:case 3:System.out.printf("%d月是属于第一季度",n);break;case 4:case 5:case 6:System.out. 阅读全文
posted @ 2013-03-15 18:40 徐慧同学 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 例3-2public class Test3_2{public static void main(String args[]){char a[]={'金','木','水','火','土'};char secret='z';for(int i=0;i<a.length;i++){a[i]=(char)(a[i]^secret);}System.out.printf("密文:\n");for(int i=0;i<a.length;i++){System.out.print 阅读全文
posted @ 2013-03-15 18:39 徐慧同学 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 例1—1 class A{ void f(){ System.out.println("I am A"); } } class B{ } public class Hello{ public static void main(String args[]){ System.out.println("你好,很高兴学习Java"); A a=new A(); a.f(); } } 例p9public class Tom{int leg;String head;void cry(String s){System.out.println(s);}}class Ex 阅读全文
posted @ 2013-03-14 22:13 徐慧同学 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 1.在oracle网站下载的jdk,下载后双击问我是否重新安装,无法打开,也看不见其他附属文件。2.在配置环境时忘记加分号了,无发配置成功。 阅读全文
posted @ 2013-03-07 22:22 徐慧同学 阅读(209) 评论(2) 推荐(3) 编辑
摘要: import java.util.*;public class Example{ public static void main(String args[]){ Scanner reader=new Scanner(System.in); int mul=1; while(reader.hasNextInt()){ int x=reader.nextInt(); mul=mul*x; } System.out.printf("%d这些整数的乘积为%f\n",mul); }} 阅读全文
posted @ 2013-03-07 21:29 徐慧同学 阅读(114) 评论(0) 推荐(3) 编辑