#40 Encapsulation in Java

Telusko January 18, 2023
Video Thumbnail
Telusko Logo

Telusko

@telusko

About

Hey Aliens Welcome to Telusko! We create technical tutorials that take you from beginner to advanced level. You’ll find content on: Core Programming: Java (Beginner to Advanced), Python, JavaScript Frameworks & Tools: Spring Framework, Hibernate, Blockchain, Spring AI, AI Engineering Computer Science Essentials: Data Structures, Networking, System Design, and more Trending Tech: Cloud, Microservices, and beyond Alongside technical tutorials, we also share motivational videos and host sessions with leading industry experts. We don’t just stop at free tutorials—we also provide paid courses (live and recorded) and corporate training to help professionals and organizations upskill. So, whether you’re just starting out or sharpening your professional skills, there’s always something here for you. 📩 Business Inquiries: [email protected] 🎓 Explore Live & Recorded Courses: https://telusko.com/

Video Description

Check out our courses: AI-Powered DevOps with AWS Live Course V2: https://go.telusko.com/ai-devops-v2 Coupon: TELUSKO10 (10% Discount) Java Spring Boot AI Live Course: https://go.telusko.com/JavaSpringBootAI Coupon: TELUSKO20 (20% Discount) Master Java Spring Development : https://go.telusko.com/masterjava Coupon: TELUSKO20 (20% Discount) Udemy Courses: Java Spring:- https://go.telusko.com/Udemyjavaspring Java:- https://go.telusko.com/udemyteluskojava Spring: https://go.telusko.com/udemyteluskospring Java For Programmers:- https://go.telusko.com/javaProgrammers Python : https://go.telusko.com/udemyteluskopython Git : https://go.telusko.com/udemyteluskogit Docker : https://go.telusko.com/udemyteluskodocker For More Queries WhatsApp or Call on : +919008963671 website : https://courses.telusko.com/ Instagram : https://www.instagram.com/navinreddyofficial/ Linkedin : https://in.linkedin.com/in/navinreddy20 TELUSKO Android App : https://go.telusko.com/TELUSKOAPP TELUSKO IOS App : https://apple.co/3SsgmU2 Discord : https://discord.gg/D8hWe9BqfF In this lecture we are discussing: 1)What is encapsulation? 2)how to achieve encapsulation 3)Benefits of encapsulation 4)how to use private data? #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. #4 how to use private data? -- using setters and getters method we can set and get the value of variable. -- private int num; public int getNum( ) { return num; } public void setNum(int num) { this.num=num; } Note: Always make variable as private and method as public to achieve security in program. Github repo : https://github.com/navinreddy20/Javacode.git More Learning : Java :- https://bit.ly/3x6rr0N Python :- https://bit.ly/3GRc7JX Django :- https://bit.ly/3MmoJK6 JavaScript :- https://bit.ly/3tiAlHo Node JS :- https://bit.ly/3GT4liq Rest Api :-https://bit.ly/3MjhZwt Servlet :- https://bit.ly/3Q7eA7k Spring Framework :- https://bit.ly/3xi7buh Design Patterns in Java :- https://bit.ly/3MocXiq Docker :- https://bit.ly/3xjWzLA Blockchain Tutorial :- https://bit.ly/3NSbOkc Corda Tutorial:- https://bit.ly/3thbUKa Hyperledger Fabric :- https://bit.ly/38RZCRB NoSQL Tutorial :- https://bit.ly/3aJpRuc Mysql Tutorial :- https://bit.ly/3thpr4L Data Structures using Java :- https://bit.ly/3MuJa7S Git Tutorial :- https://bit.ly/3NXyCPu Donation: PayPal Id : navinreddy20 https://www.telusko.com