Sunday, June 14, 2015

Java access specifiers and access modifiers

Acording to java language specification, Java have following access modifiers :
1. Public
2. Protected
3. Default
4. Private

Reference : https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html

And, Java 'access specifier' term is used synonymously with 'access modifier'.

But for the sake of understanding let's categorized as follows :

1. Java access modifiers :
    (a). Public
    (b). Protected
    (c). Default
    (d). Private

You can find the description of above specifiers at many places.

2. Other keywords that affects visibilty/access usually called non access modifiers :

[i]. For variables:
    (a). static
    (b). final
    (c). native
    (d). volatile
    (e). abstract
    (f). transient

[ii]. For methods:
    (a). abstract
    (b). final
    (c). synchronized
    (d). static

[iii[. For classes:
   (a). abstract
   (b). strictfp
   (c). final
  

No comments:

Post a Comment