Java OOPS Concepts in Selenium - What is Encapsulation?

preview_player
Показать описание
Learn about the OOPs concept Encapsulation with some real world examples.

- Encapsulation is the process of wrapping up data under a single unit
- It is the ability of an object to hide its data and methods
- Class helps us to encapsulate the fields which hold the state of object and methods which define the actions of the object
- It is a protective shield that prevents the data from being accessed by the code outside the shield
- Encapsulation can be achieved by declaring all variables in the class as private and writing public methods in the class to set and get the values of the variables

Found this video interesting - Please Like and Share the video.

Have Feedback/Questions - Leave a comment below.

Get access to 100 plus videos on different automation tools. Also never miss out on any new video posted on our channel.

Other Video Playlists on our Channel:
Postman:
Selenium:
Jenkins 2.0:
Maven:

Рекомендации по теме
Комментарии
Автор

Hello
Can you answer this?
If my goal is to update the value of any car class variable, say color then why should I call a method of car class to do so?
I can write this in my tata class itself:
car.color= "White";
So why Did I encapsulate my variable? Can be done without using method as well?

piyushmathpal
join shbcf.ru