2013年4月5日

显示本机时间

摘要: import java.util.Date; public class E413 { public static void main(String args[]){ Date date=new Date(); System.out.printf("Time: \n%s",date); }}结果:Time: Fri Apr 05 11:19:31 CST 2013 阅读全文

posted @ 2013-04-05 11:21 agony· 阅读(234) 评论(0) 推荐(0) 编辑

摘要: package tom.jiafei; class Tom{ void speak(){ System.out.println("Tom类在tom.jiafei包中"); } } public class E12 { public static void main(String args[]){ Tom cat=new Tom(); cat.speak(); System.out.println("E412类也在tom.jfiia包中"); }} 阅读全文

posted @ 2013-04-05 11:15 agony· 阅读(134) 评论(0) 推荐(0) 编辑

构造cry

摘要: public class Tom { int leg; Tom(int n){ cry(); leg=n; cry(); } void cry(){ System.out.println("我是Tom,我现在有"+leg+"条腿"); } public static void main(String args[]){ Tom cat=new Tom(4); }}结果是我是Tom,我现在有0条腿我是Tom,我现在有4条腿 阅读全文

posted @ 2013-04-05 11:01 agony· 阅读(113) 评论(0) 推荐(0) 编辑

类Area的getArea方法是一个重载方法

摘要: class People{ double getArea(double x,int y){ return x*y; } int getArea(int x,double y){ return (int)(x*y); } double getArea(float x,float y,float z){ return(x*x+y*y+z*z)*2.0; } } public class kkkkk { public static void main(String args[]){ People zhang=new People(); System.out.println("面积:&quo 阅读全文

posted @ 2013-04-05 10:53 agony· 阅读(602) 评论(0) 推荐(0) 编辑

导航