接口与抽象类 [英] Interface vs Abstract Classes

查看:25
本文介绍了接口与抽象类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对抽象类和接口类之间的区别有点熟悉,但是你觉得下面这句话是什么意思?

I am a little bit familiar with the difference between Abstract and Interface classes but What do you think is the meaning of the sentence below?

接口只能定义常量,而抽象类可以有字段.

An interface can only define constants while abstract class can have fields.

推荐答案

接口只能定义常量,而抽象类可以有字段.

An interface can only define constants while abstract class can have fields.

来自接口的字段是隐式的 public, static, final

your field from interface is by implicitly public, static, final

抽象类不是这种情况

这篇关于接口与抽象类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆