Java access specifiers
Real life example to understand access specifiers in java
In Programming Terms:
There are four Access Specifiers in Java.
1. Public
2. Private
3. Default.
4. Protected
There are four Access Specifiers in Java.
1. Public
2. Private
3. Default.
4. Protected
I can't really think of any better real life example than FACEBOOK post.
When you update your Facebook Status, it gives you 4 options
1. If you make this status visible for Public, anyone can see this status on Internet (Anyone On or Off Facebook). [Public Access Specifiers].
When you update your Facebook Status, it gives you 4 options
1. If you make this status visible for Public, anyone can see this status on Internet (Anyone On or Off Facebook). [Public Access Specifiers].
2. If you make this status visible "only for me". No one can see this status except you. [Private Access Specifiers].
3. If you make this status visible for Friends or Friends of friends, then your status will be only visible for your friends and your friends friends. Not everyone presents on Facebook or Internet. [Protected Access Specifiers].
4. If you make this status visible for "Friends", then your status will be only visible for your Friends. Not your friends friends or everyone presents on Facebook. [Default Access Specifiers].
See the link below:
Comments
Post a Comment