Feel this challenge to have helped me become consisten in the code that I type, additionally type cleaner code in itself.
Day 17/100
Language:
JAVA
Time Period Spent:
2hrs
Course Taken:
Udemy: Java Programming Masterclass - Tim Buchalka
Todays Learning:
Encapsulation
-
Challenges:
- Real-world Printer
Additional Notes:
Today was a constructive day. After learning encapsulation, I can now safely say that there is functional use for this as we can lockdown a class and only display what we wish the user to use from.
As written by Throben Jenssen:
By definition, encapsulation describes the idea of bundling data and methods that work on that data within one unit, like a class in Java. This concept is also often used to hide the internal representation, or state of an object from the outside. This is called information hiding.
The general idea of this mechanism is simple. For example, you have an attribute that is not visible from the outside of an object. You bundle it with methods that provide read or write access. Encapsulation allows you to hide specific information and control access to the internal state of the object.
If you’re familiar with any object-oriented programming language, you probably know these methods as getter and setter methods.
Top comments (0)