Join Peggy Fisher for an in-depth discussion in this video Using encapsulation, part of Java Essential Training for Students.
- View Offline
- Exercise Files
- Let's take a minute to talk about encapsulation.…Encapsulation is one of the benefits of using…object-oriented programming languages.…It allows the programmer to hide…the instance data definitions…as well as protect the integrity of the instance data.…It hides the method implementations.…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.…
It always helps to have a concrete example.…So let's think about a checking account.…Inside a checking account you have a balance.…It's declared as private so it can only be updated…using a method.…One of the operations that you can perform on your balance…is you can withdraw money.…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…get overdrawn by withdrawing more money…than what is in the account.…
- Getting started with parsing
- Reviewing data types
- Using decisions
- Creating user-defined methods
- Command-line debugging
- Exploring the Java API
- Creating and instantiating classes
- Working with interfaces
- Storing items with arrays
Skill Level Intermediate
1. Command Level Programming
2. Basics Review
4. Java API
5. Simulations and Algorithm Analysis
6. Classes and Objects
7. More on Classes
8. Data Structures
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.