详细信息

论Java中抽象类与接口的区别     被引量:1

Differences Between Sbstract Class and Interface in Java

文献类型:期刊文献

中文题名:论Java中抽象类与接口的区别

英文题名:Differences Between Sbstract Class and Interface in Java

作者:宋灵香[1];王琰[1]

第一作者:宋灵香

机构:[1]定西师范高等专科学校计算机科学系,甘肃定西743000

第一机构:甘肃中医药大学定西校区

年份:2014

卷号:19

期号:2

起止页码:21

中文期刊名:甘肃高师学报

外文期刊名:Journal of Gansu Normal Colleges

收录:国家哲学社会科学学术期刊数据库

基金:定西师范高等专科学校校级项目(1334)

语种:中文

中文关键词:抽象类;接口;封装;继承

外文关键词:abstract class;;Interface;;encapsulation;;inherit

摘要:在运用Java语言编程时,可以把抽象类和接口理解为两个比较特殊的类.抽象类在Java语言中表示的是一种继承关系,接口可看做是一种特殊的抽象类,但抽象类和接口之间有着本质的区别.Java语言不支持多继承性,即一个子类只能有一个父类,但是在解决实际问题中有时子类需要继承多个父类的特性,Java语言使用接口有效的解决这个问题.一个类可以同时实现多个接口.因此,Java语言用接口有效的弥补了单继承性的缺点.
In the use of the Java programming language, can make the abstract class and interface as the two special class. Abstract class in Java language is a kind of inheritance, interface can be seen as an abstract class of special, however between abstract class and interface has essential difference.The Java language does not support multiple inheritance, That is a sub class can have only one parent class,but in solving practical problems sometimes subclasses need to inherit from more than one parent class characteristics,the use of Java language interface effectively solve this problem. A class can implement multiple interfaces. Therefore,the Java language interface effectively compensate for the shortcomings of single inheritance.

参考文献:

正在载入数据...

版权所有©甘肃中医药大学 重庆维普资讯有限公司 渝B2-20050021-8 
渝公网安备 50019002500408号 违法和不良信息举报中心