Join Peggy Fisher for an in-depth discussion in this video Using encapsulation, part of Up and Running with Java.
- In object-oriented programming languages,…you'll often hear the term encapsulation.…Encapsulation ensures data integrity and reusability.…Encapsulation is one of the benefits of using…object-oriented programming languages.…It allows the programmer to hide…the definition of instance data…and methods from the user.…This ensures that data structures and operators…are used as intended.…Encapsulation can be described as a protective barrier…that prevents the code and data…from being randomly accessed by other code,…defined outside the class.…
Let's think about a checking account.…The balance is declared as private,…so it can only be updated using a method.…The withdraw method checks to make sure…the balance is greater than the withdrawal amount…prior to reducing the balance.…This provides a way to make sure the customer…cannot withdraw more money than what is in the account.…Some banks might also charge a withdrawal fee.…That logic would be included in the method as well.…This is an example of encapsulation.…For a more detailed explanation, please refer to…
- Downloading and exploring NetBeans
- Understanding Java basics: data types, strings, arrays, and more
- Controlling flow with functions and loops
- Creating classes
- Sorting and searching arrays
- Manipulating files
- Handling errors
- Building GUIs
Skill Level Beginner
1. Getting Started
2. Java Basics
3. Flow of Control
4. Classes and Objects
5. Beyond the Basics
6. File Manipulation
7. Graphical User Interface Basics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.