大家好,我是小跳,我来为大家解答以上问题。rectangle函数参数,rectangle函数很多人还不知道,现在让我们一起来看看吧!
1、public class Rectangle {
2、public double len;
3、public double width;
4、public double getArea(double len,double width){
5、return len*width;
6、}
7、public double getLen() {
8、return len;
9、}
10、public void setWidth(double len) {
11、this.len = len;
12、}
13、public double getWidth() {
14、return width;
15、}
16、public void setWidth(double width) {
17、this.width = width;
18、}
19、public static void main(String[] args) {
20、Rectangle r = new Rectangle(40, 10);
21、System.out.println(r.getArea(r.getLen(), r.getWidth()));
22、}
23、}
本文到此讲解完毕了,希望对大家有帮助。
免责声明:免责声明:本文由用户上传,与本网站立场无关。财经信息仅供读者参考,并不构成投资建议。投资者据此操作,风险自担。 如有侵权请联系删除!