Object-oriented programming (oops) is a style of programming characterized by the identification of classes of objects closely linked with the methods (functions) with which they are associated. It also includes ideas of inheritance of attributes and methods.
Here We can see:
which means that we made a class name as Animal which contains objects like:
Animal Dog = new Animal();
The programming with class and objects is called object oriented programming.
In object-oriented programming , a class is a template definition of the methods and variable s in a particular kind of object . for Example:
An object is a collection of properties, and a property is an association between a name (or key) and a value.
it is process of hiding implementation details and only showing the functionality to the user.
When a Base Class Inherit to the derived class that process is called inheritnce.
class Electronics Derived class: 1. TV extends Electronics 2. Mobile extends Electronics 3. AC extends Electronics
when we create a same function in diffferent classes is called polymorphism. for example:
we create a animal class then we can create sum more classes extends Animal: Cat: void sound('meow'); Dog: void sound('bark'); Lion: void sound('roar');
Encapsulation in Java is a powerful mechanism for storing the data members and data methods of a class together.