用JAVA怎麼編一個長方形的面積
package com.area;
public class Area {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
juxing a=new juxing();
a.setHeight(20);
a.setLength(20);
a.setArea(a.getHeight()*a.getLength());
System.out.println(a.getArea());
}
class juxing{
public int length;
public int height;
public int area;
public int getArea() {
return area;
public void setArea(int area) {
this.area = area;
public int getHeight() {
return height;
public void setHeight(int height) {
this.height = height;
public int getLength() {
return length;
public void setLength(int length) {
this.length = length;
用JAVA怎麼編一個長方形的面積
package com.area;
public class Area {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
juxing a=new juxing();
a.setHeight(20);
a.setLength(20);
a.setArea(a.getHeight()*a.getLength());
System.out.println(a.getArea());
}
}
class juxing{
public int length;
public int height;
public int area;
public int getArea() {
return area;
}
public void setArea(int area) {
this.area = area;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}