java,编写一个矩形类,

package org.hanqi.pn0120;

public class JuXing {
    double chang;
    double kuan;
    JuXing(double chang,double kuan)
    {
        this.chang=chang;
        this.kuan=kuan;
    }
    //计算面积
    double getMianJi()
    {
        return this.chang*this.kuan;
    }
    public static void main(String[] args)
    {
        JuXing myJX=new JuXing(10,5);
        System.out.println(""+myJX.getMianJi());
        
    }

}

 

你可能感兴趣的:(java,编写一个矩形类,)