开发者社区 问答 正文

如何调用行为?

已解决

如何调用行为?

展开
收起
游客m3boi7lqsjbs2 2022-04-02 20:40:13 743 分享 版权
1 条回答
写回答
取消 提交回答
  • 推荐回答

    调用行为:

    public static void main(String args[]){

    fun(new Human());

    fun(new Pig());

    fun(new Robot());

    }

    public static void fun(Action action){

    action.command(Action.EAT + Action.SLEEP + Action.WORK);

    }

    }

    2022-04-02 21:53:21
    赞同 展开评论
问答地址: