Sunday, 30 October 2016

OBJECT ORIENTED FEATURES OF JAVA

Tags

1. Encapsulation :is one of the four fundamental OOP concepts. The other three are inheritance, polymorphism, and abstraction.
Encapsulation in Java is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class. Therefore, it is also known as data hiding.
To achieve encapsulation in Java −
·        Declare the variables of a class as private.
·        Provide public setter and getter methods to modify and view the variables values.
2. Data Abstraction : With this data is hidden inside object and is only accessible through object. Abstraction is the process used to hide certain details and only shows essential featues of object. In other words , it deals with outside view of an object . it also includes concepts of abstract method and abstract classes which we will discuss shortly.

3. Inheritance : Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea behind inheritance in java is that you can create new classes that are built upon existing classes , its 4 types are --
Single   ,  Multilevel  , heirarchecal  , and Hybrid


4.Polymorphism : It is the ability of an object to take on many forms. The most common use of polymorphism in oop occurs when a parent class reference is used to refer to a child class object. Any java object that can pass more than on IS-A test is considered to be polymorphic. It includes application of virtual method which we will discuss later .






Enter Your Comments Below Emoticon