public class WuMingFen {
String theMa = "酸辣";
int quantity = 2;
boolean soup = false;
public WuMingFen() {
soup = true;
}
public WuMingFen (String theMa, int quantity, boolean soup){
this.theMa = theMa;
this.quantity = quantity;
this.soup= soup;
}
public WuMingFen (String theMa, int quantity){
this.theMa = theMa;
this.quantity = quantity;
}
public void check(){
System.out.println("面码:"+ theMa +",粉的份量:"+ quantity +"两,是否带汤:"+ soup);
}
}
为什么有下面这个构造函数?
public WuMingFen() {
soup = true;
}