Saturday, 25 June 2016

OOPs in Java

OOPs in Java:-
Following are the four basic object oriented principles:-
1. Abstraction
2. Encapsulation
3. Inheritance
4. Polymorphism

1. Abstraction:- The process of providing the necessary attributes and operations, then hiding unrelated attributes and relations are called abstractions.

Example:-  Take  an entity called T.V. Remote, to use that entity, the main required things  are how many buttons are there and what are their functionality, how many  volts batteries are used. There  are many basics things: therefore the end user to use. The remote have something like internal functionality –when pressed the remote button perform a tasked which is hide from end users.

2. Encapsulation:- Encapsulation the  process of defining all the properties and operation of an object in an entity.
In Java:
1. You can call the entity as class   2.Variables when you are writing in the class  are properties of an object  and Methods are operation an objects.
3.Variables defines in the class. It should be used  by method which define in the class

3. Inheritance:- The Process of defining the new entity by using  existing entities, attributes and operations is called inheritance.
In Java:- We can defines as Follows
1. The process  of writing a new class by usng existing class is called inheritance.
2. Existing class is called Superclass or Base class or Parents Class
3. A newly created class is called subclass or derived class or child class.

4.Polymorphism:- The operations behaving different in different situation is called the polymorphism.

In case of the remote entities, the button with red colour will be do two operations.
Switch on tv
Switch -off tv

No comments:

Post a Comment