View RSS Feed

Java Object

IS-A Relationship

Rate this Entry
by , 04-26-2012 at 06:31 PM (2739 Views)
IS-A means this object is that objectís type. Now see, how inheritance is achieved by extends keyword
Java Code:
public class Animal{

public class Mammal extends Animal{

public class Reptile extends Animal{

public class Dog extends Mammal{
Following are true for the Object Oriented terms, based at above example:
  • Mammal classís superclass is animal.
  • Reptile classís superclass is animal.
  • Sub classes of Animal class are Reptiles & Mammals.
  • Animal & Mammal classes have subclass dog.

Considering the IS-A relationship, we can say:
  • Reptile IS-A Animal
  • Mammal IS-A Animal
  • Dog IS-A Animal as well
  • Dog IS-A Mammal

Submit "IS-A Relationship" to Facebook Submit "IS-A Relationship" to Digg Submit "IS-A Relationship" to Submit "IS-A Relationship" to StumbleUpon Submit "IS-A Relationship" to Google