package test3;
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);
}
}
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);
}
}
{
this.Product="A001";
this.Rate=5;
}
======================
是这个吗?这是构造器