Page 360 - CITS - Computer Software Application -TT
P. 360

COMPUTER SOFTWARE APPLICATION - CITS




           Java Inheritance Example






















           Types of inheritance in java
           On the basis of class, there can be three types of inheritance in java: single, multilevel and hierarchical.
           In java programming, multiple and hybrid inheritance is supported through interface only. We will learn about
           interfaces later.





















           When one class inherits multiple classes, it is known as multiple inheritance. For Example:
           ADVERTISEMENT























           Single Inheritance Example
           When a class inherits another class, it is known as a single inheritance. In the example given below, Dog class
           inherits the Animal class, so there is the single inheritance.



                                                           347

                             CITS : IT&ITES - Computer Software Application - Lesson 94 - 100
   355   356   357   358   359   360   361   362   363   364   365