Last active
January 20, 2017 13:24
-
-
Save dhust/4ffd20d213debd8429e55efc8b6e82bf to your computer and use it in GitHub Desktop.
Encapsulation non-example.
There's no setter for the age & the age is public, so anyone can change it to anything they want, even invalid values.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EncapsulationNonExample { | |
// variables | |
public int age; | |
// default constructor | |
public EncapsulationNonExample() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment