简单java应用程序备录

public class B
{
   public static void main(String args[])
{
   Rect A=new Rect();
   Rect C=new Rect(3,5);
   System.out.println(A.computerArea()+' '+C.computerGirth());
   System.out.println(C.computerGirth()+' '+A.computerArea());
}
}
     
 
class Rect
{
   double sideA,sideB;
   double sideC,sideD;
   Rect()
{   this.sideA=3.0;
    this.sideB=3.0;
}
   Rect(double a,double b)
{
     sideC=a;
     sideD=b;
}
   double computerArea()

     return sideA*sideB;

    double computerGirth()
{
     return (sideC+sideD)/2;
}
}

  

posted on 2012-10-29 19:26  @ 小浩  阅读(201)  评论(0编辑  收藏  举报