java-Cannot reduce the visibility of the inherited method from 父类
来源:互联网 发布:客户提醒软件 编辑:程序博客网 时间:2024/06/05 18:25
java-Cannot reduce the visibility of the inherited method from 父类
版权声明:本文为博主原创文章,未经博主允许不得转载。
2014-07-17 10:38 by SchrodingerCat
在Java里面,当A类继承B类,在B类里面重写(或叫覆写/override)A类的方法时,有一个规定,那就是:子类的该方法的权限修饰符范围应该是大于等于父类。
class A{
protected method() { }
}
class B extends A{
private method(){ }
//private是错误的,会出现错误提示:Cannot reduce the visibility of the inherited method from B
//将protected,public或者缺省(不加)都是可以正常编译。
}
阅读全文
0 0
- java-Cannot reduce the visibility of the inherited method from 父类
- java-Cannot reduce the visibility of the inherited method from 父类
- java-Cannot reduce the visibility of the inherited method from 父类
- Cannot reduce the visibility of the inherited method from
- Java错误提示------------------Cannot reduce the visibility of the inherited method from MouseListener
- Java编译错误:Cannot reduce the visibility of the inherited method from <class>
- Cannot reduce the visibility of the inherited method from 编译错误
- Cannot reduce the visibility of the inherited method from Interface解决办法
- Android问题:DescriptionResourcePathLocationType Cannot reduce the visibility of the inherited meth
- Cannot override the final method from HibernateDaoSupport
- must implement the inherited abstract method 问题解决
- Cannot override the final method from SherlockFragmentActivity问题解决方案
- java运行异常duplicate methods named spliterator with the parameters () and () are inherited from the typ
- The method of getChildHtml
- 遇到the static method cannot hide instance method from object可能是因为一下原因。
- Cannot make a static reference to the non-static method setInAnimation(Animation) from the type View
- String cannot be resolved to a type - The method getContextPath() from the type HttpServletRequest r
- Cannot make a static reference to the non-static method getLocalActivityManager() from the type Acti
- JavaScript学习笔记6 面向对象之继承
- UFT-DataTable的使用
- Redis Cluster学习笔记
- ros_arduino_bridge使用总结
- redis3.0 集群在windows上的配置
- java-Cannot reduce the visibility of the inherited method from 父类
- Redis 字符串介绍及相关命令
- JS中document操作元素属性
- sql语句
- C#+ArcEngine:shp矢量点转Tin(VS2010窗体+代码)
- bootstrap使用手册
- 一道有趣的题目007
- rhel7磁盘分区
- eclipse中tomcat启动超过45秒无法启动的问题解决