标签:构造方法 ring string soup main pre stat ati str
public class Fen { String mianma; int liang; boolean likesoup; Fen(String m, int l, boolean s){ mianma=m; liang=l; likesoup=s; } public Fen(String m, int l) { mianma=m; liang=l; } public void eat(String mianma,int liang,boolean likesoup){ } public void eat(String mianma,int liang){ System.out.println(mianma+liang); } public void eat(String mianma){ System.out.println(mianma); } public void check(){ System.out.println(mianma+liang+likesoup ); } }
public class Test{ public static void main(String[] args) { Fen f=new Fen("牛肉", 2, false); f.check(); f.eat("牛肉",3); Fen f1=new Fen("酸辣", 2, true); f1.check(); } }
标签:构造方法 ring string soup main pre stat ati str
原文地址:http://www.cnblogs.com/zyy1130/p/6687695.html