Modifier   Class   Package   Subclass   World
public   $\checkmark$   $\checkmark$   $\checkmark$   $\checkmark$
protected   $\checkmark$   $\checkmark$   $\checkmark$   $\times$
No modifier   $\checkmark$   $\checkmark$   $\times$   $\times$
private   $\checkmark$   $\times$   $\times$   $\times$

It is probably worth pointing out that in the case of no modifier, whether or not the subclass can see it’s superclass’s methods/fields depends on the location of the subclass. If the subclass is in another package, then the answer is it can't.
If the subclass is in the same package then it CAN access the superclass methods/fields.



Published

11 January 2014

Category

development

Tags