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 |

No comments:
Post a Comment