Encapsulation protects internal object state from accidental changes:
public— Accessible from anywhere.protected— Accessible inside the class and its child classes.private— Accessible only inside the class where it is defined.
ADVERTISEMENT