Like I mentioned earlier, Java is object oriented. So it is going to have all the concepts of it embedded. So let's take a peek at it! There are four key features namely,
The dictionary defines abstraction as "the quality of dealing with ideas rather than events". Java follows the same idea. It is the force that hides private implementation details behind public interfaces. Let us take the air conditioner for an instance. We don't see how cold air comes out.The working of the A/C is not open to the user. That is abstraction.
Encapsulation is defined as "the condition of being enclosed". Here it is the hiding of certain elements of the implementation of a class but providing a public interface for the client software. Let us look at the A/C again. Showing just the temperature and hiding all the other parts is encapsulation.
Otherwise called subclassing, this is the mechanism of extending an already existing class called the parent/super class and the extended class called the child/sub class. Let us take a vehicle for instance. It can a 4 wheeler or a 2 wheeler. So vehicle is the super class and 4 wheeler is the sub class.
The object has only one form, the one that is given to it during construction, but a variable is polymorphic because it can refer to objects of different forms. Let us take 2 classes- an employee and manager. A manager is also an employee so all the attributes and methods applicable to employee is also legitimate on a manager. This is referred to as polymorphism.
To begin with, OOP follows bottom up approach while POP follows top down approach.
In OOP, program is divided into segments called objects while in POP, it is divided into functions.
OOP has access specifiers namely private, public and protected while POP has none.
In OOP, overloading is possible in the form of Function Overloading and Operator Overloading while it is not possible in POP.
In OOP, importance is given to data rather than functions. It is the other way round in POP.
Examples of OOP are C++,JAVA, C#.NET and for POP: C, VB and Pascal.
So I believe we are okay with the concepts of OOP now.. So let us Dive Into Java!
Post your comment
Says:User