Saturday 8 November 2014

Overview of JAVA


As we all know java is object-oriented.
What do you mean by Object-oriented?
Well, Object-oriented means, everything we deal with, in java is basically an object.
When we get into the later topics you will understand the power of objects.
What is an Object?
Object is an instance of class. In objected oriented programming languages as in java this concept is mainly taken from the concept real world concepts. For example in the world we may have several cars(BMW, suzuki, audi..) but we represent the whole cars as a single class and when we come to any particular car brand we assign a brand name for that. This is similar Class and Object paradigms in JAVA.

What is a class?
Class is a representation of data and methods together. Class is a generalized definition for any real world objects. For example we can think of a rectangle as a single class with parameters length and breadth and we can instantiate with varying length and breadth values.
Object-oriented paradigm mainly focuses on three things
Encapsulation
Encapsulation is kind of binding together all the data and think of whole thing as a single unit. We will not encourage to express implementation details. We can take example of car model again. Here encapsulation means, the driver driving the car need not to know how each and every part part of the car is working while he driving, If he does there is a big problem..he may get frightened and likely to occur accidents. So encapsulation here works.
Inheritance
Inheritance is getting properties of once class to the other class, which minimizes redundancy of the code. We can create an area class which can be inherited by several other classes like rectangle, square, triangle, circle..etc..
Polymorphism
Polymorphism is a feature that enables an interface act as several objects depending on the situation. Here we can apply the reverse process what we applied in inheritance. We can create an area method inside each one of classes of rectangle, square and circle and we can assign area class to all these classes by creating objects.
Well if you are confused about the concepts above, don't worry it all becomes crystal clear when we go through the topics.
 So let's go ahead.

No comments:

Post a Comment