A reference to the package name used with the
JavaPackageis the name of the object's Java package. If the package is in the
sun packages, the
Packages keyword is optional.
In Java, a package is a collection of Java classes or other Java packages. For example, the
netscape package contains the package
JavaPackage is a reference to a Java package. For example, a reference to
netscape is a
JavaPackage and a property of the
JavaClass object is a reference to one of the classes in a package, such as
JavaClass hierarchy reflect the Java package and class hierarchy.
Although the packages and classes contained in a
JavaPackage are its properties, you cannot use a
for...in statement to enumerate them as you can enumerate the properties of other objects.
The properties of a
JavaPackage are the
JavaClass objects and any other
JavaPackage objects it contains.
Suppose the Redwood corporation uses the Java
redwood package to contain various Java classes that it implements. The following code creates the
var red = Packages.redwood;