使用Eclipse 進行項目開發,在實現類中的方法前面如果添加@Override就提示“Multiple markers at this line”的錯誤,問題描述如下
Multiple markers at this line
- The method getStudentByID(String) of type StudentBeanImpl must override a superclass method
- implements mgr.jc.student.service.IStudentBean.getStudentByID
出現上述問題的原因:JDK1.5不支持這種寫法。實現接口方法需要重寫抽象方法。
解決上述問題的方法如下:
方法1.選擇Eclipse的Window→Preferences→Java→Compiler,把Compiler compliance level從1.5改成1.6。
方法2.右擊project選擇最後一個properties選擇左側的java compiler,勾選裏面的框框,把java編輯器版本都改成1.6。
方法3.右擊project下的 JRE System Library[JavaSE-1.5]→Properties,Execution environment 選擇“JavaSE-1.6(JDK1.6.0_10)”,點擊確定即可。
上述3種方法都能解決題目中提到的問題,可以根據自己的習慣選擇相應的解決方法。