当前位置: 技术问答>java相关
初学,想要一个能在jbuilder下能编译的javabean的简单例子。
来源: 互联网 发布时间:2015-09-02
本文导语: 抄的一大堆错误。 package taxrate; import java.awt.*; import javax.swing.JPanel; public class taxrate { String Product; double Rate; public TaxRate() { this.Product = "A001"; this.Rate = 5; } public void setProduct (String ...
抄的一大堆错误。
package taxrate;
import java.awt.*;
import javax.swing.JPanel;
public class taxrate {
String Product;
double Rate;
public TaxRate() {
this.Product = "A001";
this.Rate = 5;
}
public void setProduct (String ProductName) {
this.Product = ProductName;
}
public String getProduct() {
return (this.Product);
}
public void setRate (double rateValue) {
this.Rate = rateValue;
}
public double getRate () {
return (this.Rate);
}
}
package taxrate;
import java.awt.*;
import javax.swing.JPanel;
public class taxrate {
String Product;
double Rate;
public TaxRate() {
this.Product = "A001";
this.Rate = 5;
}
public void setProduct (String ProductName) {
this.Product = ProductName;
}
public String getProduct() {
return (this.Product);
}
public void setRate (double rateValue) {
this.Rate = rateValue;
}
public double getRate () {
return (this.Rate);
}
}
|
这个例子不是很好吗?创建一个jsp,去调用这个类的实例。
1.my 1st product is and rate is
2.my 2ed product is and rate is
1.my 1st product is and rate is
2.my 2ed product is and rate is