Variables, methods and constructors which are declared protected can be accessed by any class in the same package code example
Example: java protected
/* similar to private keyword, but also lets both:
- subclasses
- classes in same package
access the variable, method or constructor */
class Superclass {
protected int myNumber = 5;
}
class Subclass extends SuperClass {
// has access to myNumber
}
class InAnotherPackage {
// doesn't have access to myNumber
}