Packages
Packages
A source file may start with a package declaration:
package foo.bar fun baz() {} class Goo {} // ...
All the contents (such as classes and functions) of the source file are contained by the package declared. So, in the example above, the full name of baz()
is foo.bar.baz
, and the full name of Goo
is foo.bar.Goo
.
If the package is not specified, the contents of such a file belong to "default" package that has no name.
Imports
Apart from the default imports, each file may contain its own import directives. Syntax for imports is described in the grammar.
We can import either a single name, e.g.
import foo.Bar // Bar is now accessible without qualification
or all th