This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Should added members be proteced or private?


Jeff> Should I keep everything that is not in the API spec as private,
Jeff> or can I used friendly/default or protected as necessary?  I
Jeff> assume I should not add anything public to the class.

I personally always use "private".  I find that more clear.  I only
use the default protection in those cases where I definitely need
access from some other class in the package.

Definitely do not add new public or protected fields or methods.

If the class is serializable you might also consider making sure your
implementation conforms to the serialization spec.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]