HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

#6.6 Java Tutorial | Encapsulation

306,513 views October 30, 2018 6:21

Watch on YouTube
ChannelTelusko

Description from the creator

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.

Github :- github.com/navinreddy20/Java-Tutorial-for-Begin…

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:

Agentic AI Engineering with Python : go.telusko.com/agentic-ai-python
Coupon: TELUSKO10 (10% Discount)

Master Java Spring Development : go.telusko.com/learn-master
Coupon: TELUSKO10 (10% Discount)

For More Queries WhatsApp or Call on : +919008963671

website : telusko.com/

Udemy Courses:

Java Spring:- go.telusko.com/Udemyjavaspring
Java:- go.telusko.com/udemyteluskojava
Spring: go.telusko.com/udemyteluskospring
Java For Programmers:- go.telusko.com/javaProgrammers
Python : go.telusko.com/udemyteluskopython
Git : go.telusko.com/udemyteluskogit
Docker : go.telusko.com/udemyteluskodocker

Instagram : instagram.com/navinreddyofficial/
Linkedin : in.linkedin.com/in/navinreddy20
WhatsApp : go.telusko.com/whatsapp
Discord : discord.gg/D8hWe9BqfF

More Learning :

Java - bit.ly/3xleOA2
Python :- bit.ly/3H0DYHx
Django :- bit.ly/3awMaD8
Spring Boot :- bit.ly/3aucCgB
Spring Framework :- bit.ly/3GRfxwe

Servlet & JSP :- bit.ly/3mh5CGz
Hibernate Tutorial :- bit.ly/3NWAKah
Rest API | Web Service Tutorial :- bit.ly/38RJCiy

Git :- bit.ly/3NUHB3V
JavaScript :- bit.ly/3mkcFys
Kotlin :- bit.ly/3GR2DOG


Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20

About this tutorial

Telusko published this 6:21 video tutorial on October 30, 2018. It has been watched 306,513 times on YouTube.

Channel
Telusko
Duration
6:21
Published
October 30, 2018
Views
306,513
Likes
4,514

Tags

Share

This tutorial in other languages