Access Specifiers With Real World Example

COde MaFia
2 min readApr 11, 2020

Access Specifiers are

1. Public.

2. Private.

3. Default.

4. Protected.

I will explain you one by one with FaceBook .

Public

In FB create post, if We select public privacy then Anyone can see this status on Internet.

Protected

In FB create post, if We select Custom privacy then Visible for your friends and your friends friends.

Default

In FB create post, if We select Friends privacy then Visible for your Friends.

Private

In FB create post, if We select only me privacy then No one can see this status except you.

Now ,We will see Access Modifiers in Programming

Public can access within class, within packages,same package by subclass,outside package by subclasses and global.

Protected can access within class, within packages,same package by subclass and outside package by subclasses .

Default can access within class, within packages and same package by subclass.

Private can access within class.

Thank You!!!

REF LINK TAMIL :-https://youtu.be/uNvN8fuWC3c

REF LINK ENGLISH :-https://youtu.be/lN9vJkVyVCo