Sam Peterson wrote:Or do import statements only make the classes themselves visible, and not necessarily the variables inside of them?
Access Levels 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 |
Campbell Ritchie wrote:That table is slightly inaccurate about protected access. There are some circumstances when a protected class member/constructor is invisible in a subclass.
Campbell Ritchie wrote:So an instance method or constructor or instance field declaration (I think) can use that protected member or constructor, but a static method can't.
It may be bad practice to use a protected method in a constructor.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |