定义一个矩形类,包含有长length、宽width两种属性,构造方法(要求写出初始化长和宽)和计算面积方法findAr
展开全部
举一返3吧~
public class area {
private double length;
private double width;
private double area;
public double findArea(double length,double width){
area=length*width;
return area;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
area ee=new area();
ee.findArea(10,10);
System.out.println("面积="+ee.findArea(10,10));
}
}
public class area {
private double length;
private double width;
private double area;
public double findArea(double length,double width){
area=length*width;
return area;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
area ee=new area();
ee.findArea(10,10);
System.out.println("面积="+ee.findArea(10,10));
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询