What Is Inheritance? 
Generally speaking, objects are defined in terms of classes. You know a lot about an object by knowing its class. Even if you don't know what a penny-farthing is, if I told you it was a bicycle, you would know that it had two wheels, handle bars, and pedals. 
Object-oriented systems take this a step further and allow classes to be defined in terms of other classes. For example, mountain bikes, racing bikes, and tandems are all kinds of bicycles. In object-oriented terminology, mountain bikes, racing bikes, and tandems are all subclasses of the bicycle class. Similarly, the bicycle class is the superclass of mountain bikes, racing bikes, and tandems. Each subclass inherits state (in the form of variable declarations) from the superclass. Mountain bikes, racing bikes, and tandems share some states: cadence, speed, and the like. Also, each subclass inherits methods from the superclass. Mountain bikes, racing bikes, and tandems share some behaviors: braking and changing pedaling speed, for example. 
However, subclasses are not limited to the state and behaviors provided to them by their superclass. Subclasses can add variables and methods to the ones they inherit from the superclass. Tandem bicycles have two seats and two sets of handle bars; some mountain bikes have an extra set of gears with a lower gear ratio. Subclasses can also override inherited methods and provide specialized implementations for those methods. For example, if you had a mountain bike with an extra set of gears, you would override the "change gears" method so that the rider could use those new gears. You are not limited to just one layer of inheritance. The inheritance tree, or class hierarchy, can be as deep as needed. Methods and variables are inherited down through the levels. In general, the farther down in the hierarchy a class appears, the more specialized its behavior. The Object class is at the top of class hierarchy, and each class is its descendant (directly or indirectly). A variable of type Object can hold a reference to any object, such as an instance of a class or an array. Object provides behaviors that are required of all objects running in the Java Virtual Machine. For example, all classes inherit Object's toString method, which returns a string representation of the object. Inheritance offers the following benefits: Subclasses provide specialized behaviors from the basis of common elements provided by the superclass. Through the use of inheritance, programmers can reuse the code in the superclass many times. 
Programmers can implement superclasses called abstract classes that define "generic" behaviors. The abstract superclass defines and may partially implement the behavior, but much of the class is undefined and unimplemented. Other programmers fill in the details with specialized subclasses. 

解决方案 »

  1.   

    http://www.chinaitlab.com/www/news/article_show.asp?id=28353
    这里谈到了extends的本质问题 建议去看看~
      

  2.   

    http://www.uml.org.cn/UMLApplication/UMLApplication29.htm
    在看看这个...
      

  3.   

    感谢各位仁兄。我的问题并不是我不理解什么叫做继承,而是面试的时候人家就问了这么一句话,
    我要的是准确的定义。up ,up ,up
      

  4.   

    楼上的真是神人。up,up ,up
      

  5.   

    继承是什么? 
    一般而言,物件用类别话被下定义。 你藉由知道它的类别有关一个物件知道很多。 即使你不知道一个旧式脚踏车是什么,如果我告诉了你,它是一辆脚踏车,你会知道它有了二个车轮,车拉手利和踏板。 
    物件- 定向的系统更进一步地轮流这个一个踏步并且允许课用其他的课话被下定义。 经济平均主义, 山脚踏车,空转骑脚踏车,而且汇接是各种的脚踏车。在物件- 定向的专门名词中,山骑脚踏车,空转骑脚踏车,而且汇接是所有脚踏车类别的亚纲。 同样地,脚踏车类别是山脚踏车的总纲, 空转脚踏车 , 和汇接。 每个亚纲继承从总纲陈述 (以易变申请书的形式) 。 山脚踏车,空转骑脚踏车,而且汇接共享一些状态: 步调,速率,依次类推。 同时, 每个亚纲继承来自总纲的方法。 山脚踏车,空转骑脚踏车,而且汇接共享一些行为: 刹而且变更用脚踏动加速, 经济平均主义。 
    然而,亚纲没被限制在状态和对他们被他们的总纲提供的行为。 亚纲能把变数和方法加入一他们从总纲继承。 纵排的脚踏车有车拉手利的二个席位和二个凝结; 一些山脚踏车有有一个较下跌的齿轮比的一额外组的齿轮。 亚纲代理佣金能也继承了方法而且提供专门的实施作为那些方法吗。 经济平均主义,如果你用一额外组的齿轮有一辆山脚踏车, 你会盖过 " 变速齿轮 " 方法,以便支墙斜撑可以使用那些新的齿轮。 你不被限制为只是继承的一个层。 继承爬上树, 或类别科学之分类, 可能是同样地深当做需要。 方法和变数经过水平被遗传下。 大体上,下在科学之分类头等的更远人出庭,更多特殊化了它的行为。 物件类别在类别科学之分类的顶,而且每个类别是它的子孙。 (直接地或间接地)对型态物件易变的安培能持平关于任何的物件参考, 像是一个头等的例子或一个行列。 物件提供所有物件磨合运转 Java虚拟机被需要的行为。经济平均主义,所有的类别继承物件的 toString 方法,归还一个扶梯?? 物件的表示法。 继承提供跟随利益: 亚纲提供来自由总纲提供的通常元件的基专门的行为。 经过继承的使用,程序设计者能许多次重复使用总纲的码。 
    程序设计者能履行总纲被传唤的提要给 " 一般的 " 行为下定义的类别。 抽象的总纲而且下定义可能部份地履行行为,但是许多类别是未阐明的:未解释的和未实施的。 其他的程序设计者填写有专门的亚纲细目。 
      

  6.   

    继承是子类可以不声明变量和方法就可以直接使用父类的变量和方法。但是要注意变量和方法的修饰词。
         修饰词     修饰词                      修饰词                修饰词  
    父类 priate     public                      友好的               PROTECTED子类 不能继承   无论在不在一个包里      在一个包内可以继承     在一个包里可以继承保护的变量和方法还有特殊的地方,具体清查阅资料