Skip to main content

Software > Software Development > IBM REXX Family >

NetRexx

Technical detail

Import instruction

import name;

where name is one or more non-numeric symbols separated by periods, with an optional trailing period.

The import instruction is used to simplify the use of classes from other packages. If a class is identified by an import instruction, it can then be referred to by its short name, as given on the class instruction, as well as by its fully qualified name.

There may be zero or more import instructions in a program. They must precede any class instruction (or any instruction that would start the default class).

In the following description, a package name names a package as described under the package instruction.

The import name must be one of:

  • A qualified class name, which is a package name immediately followed by a period which is immediately followed by a short class name -- in this case, the individual class identified is imported.
  • A package name -- in this case, all the classes in the specified package are imported. The name may have a trailing period.
  • A partial package name (a package name with one or more parts omitted from the right, indicated by a trailing period after the parts that are present) -- in this case, all classes in the package hierarchy below the specified point are imported.

Examples:

  import java.lang.String
import java.lang
import java.

The first example above imports a single class (which could then be referred to simply as 'String'). The second example imports all classes in the 'java.lang' package. The third example imports all classes in all the packages whose name starts with 'java.'.

If two (or more) classes with the same short name are imported, then an attempt to use that short name as a class name or type is an error, as the reference would be ambiguous.

In the reference implementation, the fundamental NetRexx and Java package hierarchies are imported by default, as though the instructions:
  import netrexx.lang.
import java.lang.
import java.math.
import java.io.
import java.util.
import java.net.
import java.awt.
import java.applet.
had been executed before the program begins. In addition, classes in the current (working) directory are imported if no package instruction is specified.

 

 

PreviousTable of contents Next
We're here to help
Easy ways to get the answers you need.
E-mail us

or call us at
877-426-3774
Priority code:
104CBW67