Object Orientation is a programming method designed for reuse and independence of software modules. A logical unit that assigns or classifies meaning for effective information management is called an object.
That is, communication between objects consists of messages, and each object is composed of methods for processing unique data.
The opposite of object orientation is procedural. Procedural orientation is a programming method that consists of an algorithm that changes the data with a structure of one data.
Class is a very important concept in object orientation. A class acts as a kind of template that creates an object. In Java, an object is always created from a class.
In Java, a class always consists of two parts: a “field” that represents a data structure and a “method” that is responsible for operations. Sometimes objects created from classes are also called instances. That is, instances and objects are used interchangeably.
In Java, the object is responsible for processing information, not the class. Object-oriented programming creates a class and then creates an object with the class you created. The generated objects process various information and execute the logic of programming. Objects can be created using new reserved words as shown below.
Student1 = new Student(mark, male, 21); Student2 = new Student(james, male, 19); Student3 = new Student(joana, female, 25);
Classes can inherit from each other. Inherited classes form a hierarchy, and in inheritance, classes in the lower hierarchy inherit all elements in the upper hierarchy. Of course, inheriting classes can create new data structures or add new methods.
A subclass that inherits is a concept that extends the superclass. In other words, it implement software that can be reused through inheritance. When you create a new class through inheritance, you declare it as a subclass of an existing class and extend the functionality of the existing class by adding properties or methods in the newly created class.
Java programming has the concept of encapsulation. Encapsulation is a way to hide the logic that performs the actual processing and provide only the functions of the object. By creating the information that should be hidden and the information that should be disclosed when the object programming is done, the user uses only the function of the object. And since the logic that handles the functions of the object is not disclosed, the stability of the program can be secured.
Encapsulating a program can prevent damage to the information contained in the object. It can only be used with a certain usage, which prevents misuse of the program and keeps independence because the data does not affect other objects even if the data is changed. It has excellent portability because you can get processed results only through the functions provided by the object. In other words, the object itself can be modularized and applied to the new system.