All the Previous Languages are Structured or we can say that they were procedural programming means in them processing is to be done in sequence manner and These are also called the Top down or either they were bottom up Languages Most Important things those must be in the Languages are Reliability, Maintainability and Reusability and user Friendly So For Achieving these things they Developed java.
OOP concentrates more on data rather the procedure to be followed or the structure of the program. It considers data as a crucial element and work towards its security. It ties data and functions together under a single entity called class and prevents any modification to the data by providing access specifies to the class. Some of the features of OOP are explained below.
Java is a purely OOP language that is developed by Sun Microsoft in 1991 and this is very popular in 1992 with named called as Oak and in 1992 java was very popular in Electrical things At that time java was used for making VCR‘s’ and Television and handheld Devices But in 1993 java was so popular and that time Scientists think that this will be the very popular in Internet for transferring Files from remote computer to local. Java is called as Purely OOP Language because Every Program of java is written into in classes
We’ll be covering the following topics in this tutorial:
Features of the OOP
A Language called as OOP Language if it supports all the Features of the OOP Language For Understanding OOPs first you have to understand few concepts
Object: An Object is a Real Word Thing Which performs a Specific Task and which has a set of Properties and Methods. Properties of Object are Also Called as Attributes of an Object and Method is also Known as the Function of the Object Like What an Object can do. An object may represent a person, place, thing, or even a bank account. For Example A Car is an Object which has a Certain Number of Properties Like Color, Model No, Average etc and a Function Known as Run When A User gives Some Race then the Car Will be Moved. For example, the objects to the class Employee can be created as:
Employee empl, emp2;
where empl, emp2 are the objects of class Employee.
Class: – A Class is that which contains the set of properties and Methods of an object in a single unit Like Animals is name of class which contains all the Properties and Methods of an Object of another Animals So if we wants to access any data from the Class then first we have to create the Object of a class Then we can use any data and method from class. A class can be defined using the keyword ‘class’. For example, a class named Employee can be defined as:
class Employee
Abstraction
It is one of the chief features of OOP that hides the implementation details from their specifications. In simple words, it is the blend of encapsulation and information hiding. It encapsulates all the essential features of the objects of a class. The attributes of the objects are called data members and the functions that operate on that data are called member functions or methods. Since Java works with classes, that feature abstraction, so, the classes are also called abstract data types.
Encapsulation
It is the wrapping up of data and functions under single unit called class. It is one of the most important features of OOP. The data is not accessible to the outside world. It provides a most striking feature called information hiding which means hiding data from direct access by the outside world. The example below shows encapsulation:
class Employee {
public static void main{String args[]) {
int emp_id, salary;
char emp_name[10];
void emp_detail() {
Code
}
}
}
Inheritance
Another feature of OOP is inheritance. Inheritance allows programmers to create new classes from existing ones. The main class is called base class or parent class and the class derived from the base class is called derived class or child class. A child class inherits its properties and attributes from its parents. There are various methods of achieving inheritance such as single inheritance, multilevel inheritance and hybrid inheritance.
Polymorphism
It provides the ability to take more than one form. Functions as well as operators can take more than one form. When an operator exhibits different forms or behavior, it is called operator overloading. When a function exhibits more than one form or behavior, it is called function overloading. Some complexity is generated through operator overloading, so this feature has been removed in Java programming
There Are Five Concepts in OOPs
1) Data Abstraction:- Data Abstraction is that in which A User Can use any of the data and Method from the Class Without knowing about how this is created So in other words we can say that A user use all the Functions without Knowing about its detail For Example When a User gives Race to Car The Car will be Moved but a User doesn’t know how its Engine Will Work
2) Inheritance:- Inheritance is very popular Concept in OOP This provides the Capability to a user to use the Predefined Code or the code that is not created by the user himself but if he may wants to use that code then he can use that code This is Called Inheritance but Always Remember in Inheritance a user only using the code but he will not be able to change the code that is previously created he can only use that code
3) Data Encapsulation:- Data Encapsulation is also Known as Data Hiding as we know with the inheritance concept of opps user can use any code that is previously created but if a user wants to use that code then it is must that previously code must be Public as the name suggests public means for other peoples but if a code is Private then it will be known as Encapsulate and user will not be able to use that code So With the help of OPPS we can alter or change the code means we can make the Code as Private or public This allows us to make our code either as public or private
4) Polymorphism:- Poly Means many and morphism means many function The Concepts Introduces in the form of Many behaviors of an object Like an Operator + is used for Addition of Two Numbers and + is also used for Joining two names The Polymorphism in java Introduces in the Form of Functions Overloading and in the Form of Constructor Overloading
5) Dynamic Binding:- Binding is used when we call the Code of the Procedure in Binding all the Code that is Linked with the single procedure is Called When a Call is Made to that Procedure Then the Compiler will found the Entire code of the Single Procedure if A Compiler will Fond all the Code of Single Procedure in Compile Time then it is Called as the Early Binding Because Compiler Knows about the code at the time of Compilation but in the Late Binding Compiler will understand all the Code at Run Time or at the Time of the Execution.
6) Message Communication:- Message Communication is occurred when an object passes the Call to Method of Class for Execution We Know for executing any method from the class First we have to create the object of class when an object passes References to function of class then In Message Communication First of all we have to Create the Object of the Class the we make Communication between the Object and the Methods of the Class
Benefits of OOPS
Because procedural-oriented languages concentrate on procedures, using a basic unit of a function, you need to spend time first working out what all of the functions are going to be and then thinking about how they should represent. With OOP languages, we focus our attention on the components perceived by the user using a basic unit of an object. You work out what all the objects are by combining data with the operations that are used to describe the way a user interacts with them.
Much easier to use in terms of designing software. Rather than thinking in terms of bytes and bits, you can think in terms of the problem space instead. You are using abstraction and higher level concepts and, because the design is more comfortable, your application development is much more productive.
The software is easier to maintain because it is much easier to understand. In turn, that makes it easier to test and to debug.
The software is reusable. There is no longer any need to keep writing the same functions repeatedly for different scenarios. Being able to reuse the same code is fast and safe because you are using code that has been thoroughly tested already and is proven to work.
OOP is used in Several Places the Features of the OOPS include
1) Inheritance: We know that OOPS Provide Inheritance with the Help of the Inheritance The Code that is Previously is used in many Places where we wants By using the Inheritance We can Create our Programs by using pre-defined code
2) In Java All the Code in the java is written into the Classes So that it is called as Purely Languages
3)In the Java Classes we can create many
4)Java Provide both types of Environments Like CUI and Also GUI
5)Java is both Compiled and Interpreter Language
6)Java is Most Popular on the Internet Because after Compilation the Code of java is First Converted into the Byte code Then after Interpreter Byte Code is Transferred into the Machine.
These are the few benefits of object-oriented programming that makes it much user-friendly. It is easier to understand and implement for the users and programmers. Object-oriented systems can easily be handled and modified as and when required. The use of objects and classes provide a descriptive view of the problem and provides an easy to understand solution to the problem. Thus, OOP can be easily and efficiently implemented in Java technology.