Modifiers are keywords that you add to those definitions to change their meanings. The Java language has a wide variety of modifiers, including the following:
1)Java Access Modifiers
2)Non Access Modifiers
Java Access Modifiers:
For better understanding, member level access is formulated as a table:
Access Modifiers |
Same Class | Same Package | Subclass | Other packages |
public | Y | Y | Y | Y |
protected | Y | Y | Y | N |
no access modifier | Y | Y | N | N |
private | Y | N | N | N |
public class className { // ...} private boolean myFlag; static final double weeks = 9.5; protected static final int BOXWIDTH = 42; public static void main(String[] arguments) { |
Non Access Modifiers:
1)Java provides a number of non-access modifiers to
achieve many other functionality. 5)The synchronized and volatile modifiers,
which are used for threads. |
Read More →