?? rectangle.java
字號:
package com.chapter2;
public class Rectangle
{
//定義類成員變量
private double width;
private double height;
private double rectangleLength;
private double rectangleArea;
//初始化類成員變量
public Rectangle()
{
this.width = 0;
this.height = 0;
this.rectangleArea = 0;
this.rectangleLength = 0;
}
//設置類成員變量width的值
public void setWidth(double d)
{
this.width = d;
}
//返回類成員變量width的值
public double getWidth()
{
return this.width;
}
//設置類成員變量height的值
public void setHeight(double d)
{
this.height = d;
}
//返回類成員變量height的值
public double getHeight()
{
return this.height;
}
//獲取類成員變量rectangleLength的值
public double getRectangleLength()
{
this.rectangleLength = this.height * 2 + this.width * 2;
return this.rectangleLength;
}
//獲取類成員變量rectangleArea的值
public double getRectangleArea()
{
this.rectangleArea = this.height * this.width;
return this.rectangleArea;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -