Access modifiers determine whether other classes can use a particular field or invoke a particular method can be public, private, protected, or default ( no modifier ). See the table given below :
Access Modifier | within class | within package | outside package by subclass only | outside package |
public | Y | Y | Y | Y |
protected | Y | Y | Y | N |
Default | Y | Y | N | N |
private | Y | N | N | N |
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTJVtbwH1ASBXN1_0n1Jlm5WR7uyA1zctxLrZnUbBfXw4UWllu-xZ4VYzT9nJe4KMYS7DRTGl7CzI5ed0rgp8ZKFMr7W2PYWYbStxPFh2s1LnvWzUb5zBPEr7CEDQR2dp0BmVr30Wu_n5BdZGnA-OXCLocxO4boX6mHhRZE1N12atUTo8v99LxM5kuaA/w619-h500/java.png)
No comments:
Post a Comment