java代码练习 work036

work036.java

package test02;


public class work036
{

	private double _length;
	private double _width;
	
	public work036(double length,double width)
	{
		this._length = length;
		this._width = width;
	}
	
	public double area()
	{
		return this._length * this._width;
	}
	
	public void setLength(double length)
	{
		this._length = length;
	}
	
	public void setWidth(double width)
	{
		this._width = width;
	}
	
	public static void main(String[] args)
	{
		work036 s1 = new work036(10.1, 4.5);
		System.out.println(s1.area());
		s1.setLength(30);
		s1.setWidth(3.2);
		System.out.println(s1.area());

	}

}


版权声明:本文为modern358原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。