zl程序教程

您现在的位置是:首页 >  其他

当前栏目

@Override is not allowed when implementing interface method详解程序员

程序员 详解 not is Allowed when method interface
2023-06-13 09:19:55 时间

使用idea导入maven项目时 会出现如下报错 

@Override is not allowed when implementing interface method详解程序员

@Override从jdk1.5开始出现的,是用来标注方法重写;通常方法重写发生在继承父类,重写父类方法,或者实现接口,实现接口方法;

@Override能够保证你正确重写方法,当重写方法出错时(方法名误写、漏掉参数)编译器会提示编译错误

1.问题出在idea得jdk版本低于1.5   :File → Project Structure → Modules  把JDK版本改成大于1.5就可以了

@Override is not allowed when implementing interface method详解程序员

2.pom文件中配置maven-compiler-plugin   

 plugin 

 groupId org.apache.maven.plugins /groupId 

 artifactId maven-compiler-plugin /artifactId 

 version 3.2 /version 

 configuration 

 source 1.7 /source 

 target 1.7 /target 

 /configuration 

 /plugin 

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/1531.html

服务器部署程序员系统优化网站设置运维