Which keyword is used to bring classes from a package into scope?

The story behind the answer

The Java keyword used to bring classes from a package into scope is `import`.

Java packages act as namespaces that organize classes, interfaces, and other types. A class can be referenced by its fully qualified name—for example, `java.util.ArrayList`—but an import declaration lets the source use the shorter name `ArrayList`. A typical declaration is `import java.util.ArrayList;`, placed after the package declaration and before the class definition.

`import` does not copy a class into the program or load it at runtime. It is a compile-time naming convenience that helps the compiler resolve a simple type name. Java also supports import-on-demand syntax, such as `import java.util.*;`, although this imports types directly in that package, not recursively from its subpackages.

The alternatives describe other languages or different Java concepts. `using` is associated with languages such as C++, `include` is common in C and C++, and `package` declares the package to which the current source file belongs. Java also supports `static import` for referring to static members without qualifying them by class name.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: