简单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;
}
}
联系方式