Question about private/ public modifiers?
If you don't declare a class private or public explicitly e.g. public class foo, but just by saying class foo will it be private or public by default? The same question applies for variables and methods.
[211 byte] By [
Antoniosa] at [2007-11-26 19:12:09]

If you don't say anything the class/member will have "package scope",i.e. anything else in that same package can access it.kind regards,Jos
That access level is called "the default access level" or informally "package private". Visibility is within the current package. Outside that package, the class, class member or class constructor will be inaccessible.
> That access level is called "the default access> level" I kind of dislike that term, because the default (and only, I think) access level for members of an interface is public.
> > That access level is called "the default access
> > level"
>
> I kind of dislike that term, because the default (and
> only, I think) access level for members of an
> interface is public.
I thought that "package access" is the more commonly used term than "default access"!
[url=http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.6]JLS section 6.6, Access Control[/url]:
In 6.6.1:
"All members of interfaces are implicitly public"
...
"Otherwise, we say there is default access, which is permitted only when the access occurs from within the package in which the type is declared."