美文网首页
Rect u = new Rect(3.5f, 4.5f);

Rect u = new Rect(3.5f, 4.5f);

作者: 哈迪斯Java | 来源:发表于2023-06-13 20:50 被阅读0次

    public class Rect {
    private float height;
    private float width;

    public Rect(float height, float width) {
        this.height = height;
        this.width = width;
    }
    
    public float square() {
        return height * width;
    }
    
    public static void main(String args[]) {
        Rect u = new Rect(3.5f, 4.5f);
        System.out.println(u.square());
    }
    

    }

    public class Demo {
    private Demo() {

    }
    
    public static Demo getInstance() {
        return new Demo();
    }
    

    }

    相关文章

      网友评论

          本文标题:Rect u = new Rect(3.5f, 4.5f);

          本文链接:https://www.haomeiwen.com/subject/yophddtx.html