1• In Java, access modifier which specifies accessibility of class,
2 methods and variables. There are four access modifiers in
3 Java namely Public, Private, Protected and Default.
4• The difference between these access-modifies is that;
5o The most importantly is the level of accessibility.
6o Public is accessible to anywhere
7o Private is only accessible in the same class which is declared
8o Default is accessible only inside the same package
9o Protected is accessible inside the same package and also
10 outside the package but only the child classes.
11• We cannot use private or protected modifier with a top--level class.
12• We should also keep in mind that access modifier cannot
13 applied for local variable public, private or protected in Java.