如何在此程序中获取用户输入的长度和宽度

问题描述

这是我写的程序,我只是想在这个程序中接受用户输入的长度和广度,我该怎么做才能接受用户输入。我试过这个,但现在不知道如何在 getter 和 setter 中输入:

public class Area{

    int a,c;  // length and breadth
    
    Area(int l,int b){
        a = l;
        c = b;
    }

    public int setDim(){
        int results = a * c;
        return results;
    }
    
    public void getArea(){
        System.out.println("Area = " +  setDim());
    }

    public static void main(String []args){
        Area x =new Area(6,5);
        x.getArea();
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)