[jdom-interest] Re: [jdom-commits] CVS Update: jdom

Stephan Trebels stephan at ncube.com
Tue Apr 1 23:42:17 PST 2003


>From the current JLS:

7.4.2 Unnamed Packages
A compilation unit that has no package declaration is part of an unnamed
package. 

 Note that an unnamed package cannot have subpackages, since the syntax
of a package declaration always includes a reference to a named top
level package. 

 As an example, the compilation unit:

        class FirstCall {
        	public static void main(String[] args) {
        		System.out.println("Mr. Watson, come here. "
        						+ "I want you.");
        	}
        }
 defines a very simple compilation unit as part of an unnamed package.

 An implementation of the Java platform must support at least one
unnamed package; it may support more than one unnamed package but is not
required to do so. Which compilation units are in each unnamed package
is determined by the host system.

 In implementations of the Java platform that use a hierarchical file
system for storing packages, one typical strategy is to associate an
unnamed package with each directory; only one unnamed package is
observable at a time, namely the one that is associated with the
"current working directory." The precise meaning of "current working
directory" depends on the host system. 

Unnamed packages are provided by the Java platform principally for
convenience when developing small or temporary applications or when just
beginning development. 


Both jikes and j2sdk1.4.1_01 work fine.


On Wed, 2003-04-02 at 05:34, Elliotte Rusty Harold wrote:
> At 9:50 PM -0500 4/1/03, bob mcwhirter wrote:
> >Beware, jdk1.4 doesn't allow things in the default/unnamed package,
> >I think.  Experienced that on some of my projects with the examples.
> >
> 
> Really? Are you absolutely sure? That would definitely screw with 
> almost every textbook out there, none of which start with
> 
> package com.publisher.greeting
> 
> public class HellowWorld {
> 
> ...
> 
> If this is true I need to revise a lot of my notes and books.
-- 
        Stephan Trebels <stephan at ncube.de>   Consultant
company: nCUBE Deutschland GmbH, Hanauer Str. 56, 80992 Munich, Germany
phone: cell:+49 172 8433111  office:+49 89 1498930  fax:+49 89 14989350





More information about the jdom-interest mailing list