Can an activity have two implements?

落爺英雄遲暮 提交于 2019-12-04 03:11:21

问题


Can I implement OnClickListener and SurfaceHolder like this :

    public class MainActivity extends Activity implements SurfaceHolder.Callback,OnClickListener

回答1:


Yes, in Java a class can implement many different interfaces.

This compensates the lack of multiple inheritance in Java, as opposed to e.g. C++ where multiple inheritance is allowed.



来源:https://stackoverflow.com/questions/17507225/can-an-activity-have-two-implements

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!