#6.6 Java Tutorial | Encapsulation

preview_player
Показать описание
In this lecture we are discussing:
1)What is encapsulation?
2)how to achieve encapsulation
3)Benefits of encapsulation

#1
What is encapsulation?
:- binding data with method to make your program secure is known as encapsulation.
Consider encapsulation as we have capsule and inside capsule everything inside a class is wrapped or encapsulated.
e.g
class A{ private int a;
public void setA(int num){a=num;}
public int getA(){return a;}
}
//here you can see that we can bind data with method inside a curly braces, it seems look like a capsule inside everything is present.

#2
how to achieve encapsulation?
:- through access specifiers private,protected,public,default . We can achieve
encapsulation.

#3
Benefit of encapsulation
i)Helpful in to achieve abstraction
ii)for security point of view it is most beneficial.
iii)you can maintain log file through method when you bind your data with method.

Note:
Always make variable as private and method as public to achieve security in program.

Practical implementation of Encapsulation in Java
In this video we will see
- Example of Encapsulation
- What is Encapsulation
- Why we need Encapsulation
- Object characteristics
- Object knows something with variable
- Object does something with method
- Getters and Setters
- Setting value and fetching value
- Running the code
- Private variables
- Public method
- Accessing variable through methods

Check out our courses:

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO20 (20% Discount)

Udemy Courses:

For More Queries WhatsApp or Call on : +919008963671

More Learning :

Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
Рекомендации по теме
Комментарии
Автор

You have the best explanations on YouTube for Java. I'm here in the US, studying at a reputable university, but these guys just assign hardass problems, instead of teaching what the concepts are and how do they apply. Thank you very much :D

suyashsharma
Автор

Amazing! So far the best instructor I've ever come across. Thank you!

sowndharyas
Автор

this is the first time I hear someone explaining why you would not want to access or change the values of instance variables directly. even my lecturer would just shrug and say "you just don't do it" or "this is not object oriented programming" (I learned to truly hate the latter phrase). thank you!

trzmaier
Автор

Sir I have attended many Java classes but never understood the concept of OOPs until I saw your video. You are really a great instructor.

shasandhakal
Автор

Wow Sir! Its went through many tutorials but never got this concept... a big Thank You

PramodKumar
Автор

Fast and direct! Thank you for answering my question on why getters and setters are needed!

jkate
Автор

OMG LITERALLY THE BEST VIDEO TO UNDERSTAND ENCAPSULATION ON ENTIRE INTERNET

Shaxadd
Автор

Best one i ever found in youtube
Sir you are the best
its been honour for me sir to be your student
thanking you sir for your pateince, helping nature and Gratitude

vamshibhai
Автор

You are very much better than other complicated OOPs explanations. You just saved my day!!🤗🤗

pranavk
Автор

bro amazing so may thing in one video, well explained business scenarios

RamKumar-uisp
Автор

at least you mentioned that you can add logs or add validations before you store or read data.

most videos on youtube or teachers are simply only describing encapsulation, not explaining why you need that.

lychenus
Автор

god your better than most american java thanks ; )

mathewfrancis
Автор

Thank you So much bro..it is a wonderful video i have never seen this kind of nice videos.Thanks again.../2

bhaskarakula
Автор

Sir, Could you please create new pack of these newly created videos.
So that I would be easy to see all new videos in one list.
Thanks.

akashkapade
Автор

what is the best IDE for creating PC application`s? Eclipse?

GamerForeverChannel
Автор

till now I had just read..the definition of this principle​ of oop but..today...I experienced it

raghavtripathi
Автор

amazing explanation straight to the point

siddhithakur
Автор

im ABC student in Banglore your concepts are deeply going inside

Westerntales
Автор

huge thanks... give ocean of knowledge is very less time...

syedidrees
Автор

Hi your videos are the best, where I get some clarity. I start surfing the concepts, get no clarity and end up watching your videos and keep motivated. Can you please compare and explain the difference between abstraction and encapsulation?

lalithyakothakota