We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
相同点:1.都可以拥有抽象方法 2.都不能实例化 不同点:1.接口需要实现类用implements关键字实现,并且支持接口与接口的多继承,类与接口的多实现。抽象类需要子类用extend关键 字继承,只支持单继承。 2.接口只可以有常量,默认是public final static修饰。抽象类既可以有普通变量,也可以有常量。 3.接口jdk1.8支持了默认方法和静态方法,1.9支持了私有方法,其余都是抽象方法。抽象类可以有任意的方法。 4.接口没有构造器,抽象类有构造器但是不能实例化,只是为了供给子类创建对象使用。 5.接口不能有初始代码块,抽象类可以。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
相同点:1.都可以拥有抽象方法 2.都不能实例化
不同点:1.接口需要实现类用implements关键字实现,并且支持接口与接口的多继承,类与接口的多实现。抽象类需要子类用extend关键
字继承,只支持单继承。
2.接口只可以有常量,默认是public final static修饰。抽象类既可以有普通变量,也可以有常量。
3.接口jdk1.8支持了默认方法和静态方法,1.9支持了私有方法,其余都是抽象方法。抽象类可以有任意的方法。
4.接口没有构造器,抽象类有构造器但是不能实例化,只是为了供给子类创建对象使用。
5.接口不能有初始代码块,抽象类可以。
The text was updated successfully, but these errors were encountered: