Java: Acess Modifiers

a thread...

(Cheatsheet Included)

What is an access modifier?

Access Modifiers are a way of providing limited visibility to methods, variables, classes.

Different access modifiers provide different visibility due to which our program because less prone to unwanted changes.
Java has four access modifiers, let's see each one by one

public:
It's the least restrictive access modifier when any class, method, or variable is defined as public then it is accessible from anywhere.
protected:
Protected methods & variables can be accessed within the same package and also accessible to all child classes.

default:
When no access modifier is specified then java treats it as default. With default methods & variables are accessible within the same package.
private:
It's the most restrictive access modifier, when given to any methods & variable it is only accessible within the same class.
Access Modifier Cheat Sheet:

More from Vikas Rajput

You May Also Like

Margatha Natarajar murthi - Uthirakosamangai temple near Ramanathapuram,TN
#ArudraDarisanam
Unique Natarajar made of emerlad is abt 6 feet tall.
It is always covered with sandal paste.Only on Thriuvadhirai Star in month Margazhi-Nataraja can be worshipped without sandal paste.


After removing the sandal paste,day long rituals & various abhishekam will be
https://t.co/e1Ye8DrNWb day Maragatha Nataraja sannandhi will be closed after anointing the murthi with fresh sandal paste.Maragatha Natarajar is covered with sandal paste throughout the year


as Emerald has scientific property of its molecules getting disturbed when exposed to light/water/sound.This is an ancient Shiva temple considered to be 3000 years old -believed to be where Bhagwan Shiva gave Veda gyaana to Parvati Devi.This temple has some stunning sculptures.