我不明白为什么我在 setInitialQuantity 方法声明中收到这些错误,有人介意看一下吗?
public class Invoice
{
private int quantity;
private String partNum;
private String partDesc;
private double unitPrice;
//constructor
public Invoice ( int initialQuantity, String partNumber, String partDescript, double unitPrice)
{
public void setInitialQuantity ( int initialQuantity )
{
quantity = initialQuantity;
}
}//end Invoice constructor
}
错误:
javac Invoice.java
Invoice.java:16: illegal start of expression
public void setInitialQuantity ( int initialQuantity )
^
Invoice.java:16: illegal start of expression
public void setInitialQuantity ( int initialQuantity )
^
Invoice.java:16: ';' expected
public void setInitialQuantity ( int initialQuantity )
^
Invoice.java:16: ';' expected
public void setInitialQuantity ( int initialQuantity )
^
4 errors