This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
A subclass inherits all of the public and protected members of its parent, no matter what package the subclass is in. If the subclass is in the same package as its parent, it also inherits the package-private members of the parent. You can use the inherited members as is, replace them, hide them, or supplement them with new members:
Now in same document there is another one given below.
Private Members in a Superclass
A subclass does not inherit the private members of its parent class.
Junilu Lacar wrote:The first one you quoted says package-private, in other words, the default visibility if you do not specify private, protected, or public.
I am not getting your mean here.
There are four accessibility specifier types -- private, protected, public, and a fourth type. The fourth type is sometimes called the default type, sometimes called the package-private type, and to specify it, you need to not use the private, protected, or public keywords.