The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Friendly access

Posted by Erik Midtskogen on August 31, 2000 at 5:14 PM

Default access acts like public access when all the files concerned are in the same package. If you write a library, you will probably want to put it in its own package. If you did this and then tried to use the library from another package or the default package, you would find that all the default-access methods and data that you used to be able to access would no longer be accessible.

A very thorough discussion of this topic can be found in Bruce Eckel's "Thinking in Java", Chapter 5.

Hope this helps!


> In many books it is writen that if we donot put public in front of a variable then it is default access . But at the same time it is also written that public access and default access are the same thing . But i donot agree with this . So I want to ask that
> What is the difference between default and public access ?


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us