是访问权限的问题,study在接口中访问权限为public的,而你在实现类中它的访问全限变为包访问权限啦,包访问权限小于公共的访问权限所以在编译时出现错误,一下是我调整过的代码- abstract class Student
- {
- abstract void study();
- }
- interface XiaoZhang
- {
- void study();
- }
- public class aa extends Student implements XiaoZhang
- {
- public void study(){System.out.println(" ");}
- }
复制代码 |