You would think that the main Java tutorial on access modifiers would be the final word on Java access modifiers. I have referred to their table enough times.
| Modifier | Class | Package | Subclass | World |
|---|---|---|---|---|
public |
Y | Y | Y | Y |
protected |
Y | Y | Y | N |
| no modifier | Y | Y | N | N |
private |
Y | N | N | N |
But one thing that caught me out today was, all methods defined in an interface are public by default. The language specification confirms this.
No comments:
Post a Comment