无名的粉

public class Fjava {

public static void main(String[] args)


{
WuMingFen f1 = new WuMingFen("牛肉",3,true);
WuMingFen f2 = new WuMingFen("牛肉",2);
WuMingFen f3 = new WuMingFen();
f1.check();
f2.check();
f3.theMa="酸辣";
f3.quantity=2;
f3.likeSoup=true;
f3.check();
}


}


public class WuMingFen {
String theMa;
int quantity;
boolean likeSoup;
public WuMingFen(String a,int b,boolean c)
{
theMa=a;
quantity=b;
likeSoup=c;
}
WuMingFen(String a,int b)
{
theMa=a;
quantity=b;
}
WuMingFen()
{}
void check()
{
System.out.println("面码为:"+theMa+"   粉的分量为:"+quantity+"  是否带汤:"+likeSoup);
}
}

你可能感兴趣的:(无名的粉)