首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

接口变量访问有关问题

2012-01-24 
接口变量访问问题interfaceI{intn3}classTestimplementsI{intn2}两个变量n重复,请问怎么表示这两个n?[

接口变量访问问题
interface   I{
  int   n=3;
}
class   Test   implements   I{
  int   n=2;
}
两个变量n重复,请问怎么表示这两个n?

[解决办法]
接口的n用I.n可以表示
Test a=new Test();
a.n;//类Test中n的表示
[解决办法]
这个同名就是设计的问题了,重新设计过

热点排行