0
点赞
收藏
分享

微信扫一扫

JAVA类

艾晓雪 2022-01-15 阅读 55
public class Restuanant {
    public static Cook cook = new Cook();
    public void takeOrder(String dish)
    {
        cook.cooking(dish);
        System.out.println("请慢用");
    }
    public String saySorry()
    {
        return "抱歉,无";
    }
    public static void main(String[] args) {
        Restuanant waiter = new Restuanant();
        System.out.println("要鱼香肉丝");
        waiter.takeOrder("鱼香肉丝");
        System.out.println("要糖醋里脊");
        waiter.saySorry();
        cook.cooking("糖醋里脊");
        System.out.println("请慢用");
    }

    static class Cook{
        public String name;
        public Cook()
        {
            this.name = "wlj";
        }
        public void cutOnion()
        {
            System.out.println("切洋葱");
        }
        public void Vegetavels()
        {
            System.out.println("洗蔬菜");
        }
        public void cooking(String dish)
        {
            cutOnion();
            Vegetavels();
            System.out.println(name+"开始煮"+dish);
        }

    }

}
举报

相关推荐

0 条评论