public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Rectangle R=new Rectangle(10,10);
System.out.println("面积为:"+R.Area());
}
}
class Rectangle{
public double width;
public double height;
Rectangle()
{
width=0;
height=0;
}
Rectangle(double w,double h)
{
width=w;
height=h;
}
public double Area()
{
return width*height;
}
}
public class Rectangle {
private int w;
private int h;
public Rectangle(){
}
public Rectangle( int w, int h) {
this.w = w;
this.h = h;
}
public double area() {
double a=this.w;
double b=this.h;
return a*b;
}
}