A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
protected and package/default access
Joined: Apr 08, 2005
Apr 11, 2005 09:27:00
What is the major difference between protected and package/default access specifiers, someone should help me please.
Joined: Aug 14, 2001
Apr 11, 2005 09:48:00
protected is less restrictive than the default and allows visibility to subclasses outside the package of the superclass. Default only allows access to subclasses within the same package as the superclass.
SCJP 1.4, www.gsi3d.org.uk
Joined: Mar 20, 2005
Apr 12, 2005 03:43:00
Protected works between packages and default works only in the same package.
this is the simplest explanation I can think of.
Life called,so here I am.<br />Cheers<br />Niki.:-)
Joined: Feb 03, 2004
Apr 12, 2005 08:28:00
When I studied Java for the exam, I used a book which called the default accessor "package private". this name really tells a lot... ;-)
I agree. Here's the link:
subject: protected and package/default access
Explicit default constructor
protected access of a class
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014