访问接口的重写变量 [英] accessing interface's overridden variable

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

问题描述

假设我有一个带字段的接口 - String type =interface。

它的实现类有一个字段 - String type =class。

有吗通过该类访问接口字段的任何方式?

Lets say I have an interface with a field - String type = "interface".
It's implementing class has a field - String type = "class".
Is there any way to access the interface's field through that class anymore?

推荐答案

是的..因为基本上接口变量是公共静态最终的或者是换句话说,常数..

Yep.. because basically interface variable are public static final or in other word, a constant..

您可以使用

IYourInterfaceName.type

这篇关于访问接口的重写变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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