|
Java is an object-oriented programming language as it works totally on the concepts of Object oriented Programming concepts.
We will try and understand the basic concept of Object Oriented Programming language and the concept of object in the section below.
Object oriented programming (called OOP for short) is the concept, which got its way after the procedural programming languages which was developed in 1970’s.
The programming language which existed before was more of process oriented and this gave the concept of small entities called objects which could be made and reused as and when the need arises.
OOP hails from the idea of Objects. All the real life entities are basically nothing but objects. In any program every code will have an object having few characteristics features called the properties of that particular object or entity and then it will always have few actions to be performed over those entities or objects termed as Methods or Functions.
To work with OOP, you should be able to identify three key characteristics of objects:
• The behavior of object — what can you do with this object, or what methods can you apply to it?
• The state of the object— how does the object react when you apply those methods?
• The identity of the object— how is the object distinguished from others that may have the same behavior and state?
This would have surely given an overview as to what is OOPs , why and how it has resulted in the beginning of a new era in programming language but to have a proper understanding on OOPs , it is very important to make yourself familiar with one more term Class .
[edit] Java Classes
The objects actually originate from the class or to define in an easy way the class is the template from which the object is derived. Whenever we create an object from the class it is called the instance of that particular class. All code that you write in Java is inside a class only.
For example there is a class called Animal and it has an instance Dog as an object to the class Animal and hence called the instance of it.
Principles of OOPs
All object programming languages provide us with few basic mechanisms which can be termed as Basic principles of OOPs and they are
1. Encapsulation
2. Inheritance
3. Polymorphism
We will discuss each one of them in detail in the section below as they hold the key to successful implementation to the object Oriented Model approach.
|