Re: Question about the package directive
John W Kennedy wrote:
I_Am_The_Walrus wrote:
I was reading a Java book tonight and it was talking about the
"package" directive. I haven't seen it used anywhere. Did it die
with one of the more recent versions or is it just obsolete but still
available?
Sample programs normally exist in their own tiny little worlds, where
using the package statement only creates clutter. Real programs use
packages.
In fact, there are certain things that cannot be done if you stay within the
default (i.e., unnamed) package. The JLS itself admonishes:
For small programs and casual development, a package can be unnamed (?7.4.2)
or have a simple name, but if code is to be widely distributed, unique package
names should be chosen (?7.7).
<http://java.sun.com/docs/books/jls/third_edition/html/packages.html>
and
Unnamed packages are provided by the Java platform principally for convenience
when developing small or temporary applications or when just beginning
development.
<http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.4.2>
--
Lew