Inheritance in Java

Inheritance

Inheritance is one of the cornerstones of object oriented programming, because it allows creating class hierarchy. In terminology of Java the class which is inherited is called the

super class” and the class that does the  inheriting is called “sub class”.

When a sub class is inherits a super class, it inherits the state and the behavior from all of its ancestors.
Lets say,  the object of A has var1 and M1. The class A is inherited by class B, that why the object of class B contains the properties and methods of class A. The class is inherited by class C, so the object of class C contains the methods and properties of class B.

Inheritance in Java

Until now you have learned the concepts of Inheritance, now before implementing it, it is important to note that Java does not support multiple Inheritance, although multiple inheritance of interfaces are allowed.

To inherit a class, you simply incorporate the definition of one class into another using the extends keyword. Read full story »

Object Oriented Principles (Part 2)

Polymorphism  is a Greek word that means “many forms”. Polymorphism is a phenomena in which same name is given to different implementations or same command name given to different commands.“Same interface for multiple methods”

Let’s take an example of a dog, a dogs sense of smell is polymorphic. If the dog smells a cat, it will bark and run after it. If the dog smells its food, it will salivate and run to its bowl. The same sense of smell is at work on both situations. The difference is what is being smelled, that is, that type of data being operated  Read full story »

Important things to remember while Programming:

 Attributes of a good Object Oriented Program

 List are some quick tips that will help you write good Object oriented programs. Remembering these tips may benefit you to out put a good, extendible Object Oriented Code. 

Read full story »

Einfobuzz Site Map