What is Encapsulation in Java - OOP Concept

preview_player
Показать описание
Learn:
Encapsulation in Java
Binding Data with Method
Getters and Setters
Data Hiding

Important notes:
Encapsulation is one of the four fundamental OOP concepts.

Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods.

If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class
Encapsulation is one of the four fundamental OOP concepts.

Encapsulation can be defined as a process of wrapping code and data together into a single unit.

Encapsulation is the technique of making the fields in a class private and providing access to the

fields via public methods.

If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class.

~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:

Follow me on my Facebook Page:

Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:

Follow me on my Facebook Page:

Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:

Paid courses (Recorded) videos:
📗 Get My Paid Courses at
Paid courses (Recorded) videos:
-------------------------------

✔️SOCIAL NETWORKS
--------------------------------

Support My Channel✔️Or Buy Me A Coffee
--------------------------------
✔️Thanks for watching!
देखने के लिए धन्यवाद
Благодаря за гледането
感谢您观看
Merci d'avoir regardé
Grazie per la visione
Gracias por ver
شكرا للمشاهدة
Рекомендации по теме
Комментарии
Автор

Thank you Naveen, great explanation :)

srinivasbadhamoni
Автор

awesome.... keep it up... make more videos on Java oops concepts... And core Java part...more demand from " Pune Maharashtra ".. Thank you so much

jiteshsharma
Автор

I was never successful in finding a tutorial that talks about what happens if the encapsulation is not done. Nobody has been able to give an example of how exactly a bad guy can create problems if the encapsulation is missed out.

rushhour
Автор

Hey Naveen, could you please explain the actual difference between Encapsulation and Abstraction.

mr.nobody
Автор

Hi Naveen, thanks for the explanation. The Getters and Setters are defined outside main but inside the class however can we create the Getters and Setters in another class to access the private instance variables of this class.

mohitgupta
Автор

Hi Naveen, Can you please make one more video on Lambda concept introduced in Java 8.

nalinaksheepanda
Автор

But what is the advantage of encapsulation here? We can change the value of data member by setter method.

ILuvBilli
Автор

can you please tell me is class variable and instance variable same?

shehenazshaik
Автор

hi naveen please post how to convert csv to json

kalyanijoshi
Автор

If I can access private variables by using getter and setter methods then it is contradicting the whole purpose of encapsulation. You cannot access private variables by creating object of that class but you can access those variables by using getter and setter. Will you please elaborate on this?

saurabh_mahurkar
Автор

Hey Navin,
Can you make video on how these oops concept are used in framework. If it's already there please provide the link.. I have searched it in your videos I didn't get it. I am planning to resume my career after maternity. I have 2 years of gap.. It will e great help if you tell me from where to starts which playlist to follow. I have total 4.5 yrs of experience in automation and functional testinfg. But due to gap it's quite difficult to get into market again. I need help.

jyotibaviskar
Автор

thank you from africa i have an exam thank u u saved me alot of reading lol

skyleenkariuki
Автор

@Naveen - Just wanted to understand how this approach of declaring class variables as "private" and calling them via getters and setters is different from having a constructor(int ssn, String empName, int empAge) to initialize these class level private variables while creating the object of the class ? - could reduce the lines of code in that case. Also was able to directly get them via objReference.variableName

vishwanathanbala
Автор

Hi Naveen, Thanks for your video..To protect some fields, we are declaring them as private.. But with the help of getter and setter, we can access those as well right? Then what is the actual use of it.. Can you please tell me?

soundaryasoudi
Автор

in real time, we only declare data members as private or we also initialize it ? and is that another reason for data hiding is that if any one wants to reuse the code so they can use it without harming the existing code ?

parthjangid
Автор

if outside person can get the value then where is the security mechanism in encapsulation.

SanjayKumar-zxdv
Автор

If outside user of the class is able to change the private variables values through getter and setter methods
Then what is the seecurity point here?

mohitsingla
Автор

emp.setEmpAge(27);
emp.empAge = 30; what is difference between this two?

mayurpatil
Автор

dear my brother tell me slowly man.Thankyou

pardhasaradhinaidu