MOCKSTACKS
EN
Questions And Answers

More Tutorials









Java Basic Terminologies in Object Oriented Programming


Four pillars of Object-Oriented-Programming Language :


1. Abstraction :


Let's suppose you want to turn on the bulb in your room. What do you do to switch on the bulb. You simply press the button and the light bulb turns on. Right? Notice that here you're only concerned with your final result, i.e., turning on the light bulb. You do not care about the circuit of the bulb or how current flows through the bulb. The point here is that you press the switch, the bulb turns on! You don't know how the bulb turned on/how the circuit is made because all these details are hidden from you. This phenomenon is known as abstraction.

More formally, data abstraction is the way through which only the essential info is shown to the user, and all the internal details remain hidden from the user.
Example :

2.Polymorphism :


One entity many forms.
The word polymorphism comprises two words, poly which means many, and morph, which means forms.
In OOPs, polymorphism is the property that helps to perform a single task in different ways.
Let us consider a real-life example of polymorphism. A woman at the same time can be a mother, wife, sister, daughter, etc. Here, a woman is an entity having different forms.
Let's take another example, a smartphone can work like a camera as well as like a calculator. So, you can see the a smartphone is an entity having different forms. Also :

3. Encapsulation :


The act of putting various components together (in a capsule).
In java, the variables and methods are the components that are wrapped inside a single unit named class.
All the methods and variables of a class remain hidden from any other class.
A automatic cold drink vending machine is an example of encapsulation.
Cold drinks inside the machine are data that is wrapped inside a single unit cold drink vending machine.

4. Inheritance :


The act of deriving new things from existing things.
In Java, one class can acquire all the properties and behaviours of other some other class
The class which inherits some other class is known as child class or sub class.
The class which is inherited is known as parent class or super class.
Inheritance helps us to write more efficient code because it increases the reusablity of the code.
Example :
Rickshaw        →        E-Rickshaw
Phone           →        Smart Phone



Conclusion

In this page (written and validated by ) you learned about Java Basic Terminologies in Object Oriented Programming . What's Next? If you are interested in completing Java tutorial, your next topic will be learning about: Java Class.



Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: mockstacks@gmail.com.


Share On:


Mockstacks was launched to help beginners learn programming languages; the site is optimized with no Ads as, Ads might slow down the performance. We also don't track any personal information; we also don't collect any kind of data unless the user provided us a corrected information. Almost all examples have been tested. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. By using Mockstacks.com, you agree to have read and accepted our terms of use, cookies and privacy policy.