Skip to content

Instantly share code, notes, and snippets.

@dhust
Last active January 20, 2017 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhust/4ffd20d213debd8429e55efc8b6e82bf to your computer and use it in GitHub Desktop.
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.
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