Exercise 1

1 Question

There are different kinds of packages. What is a generic package?


1.1

A generic package is a package with some kind of formal parameter, e.g. a replaceable type.


2 Question

What is a local package?


2.1

A local package is simply a package that is declared directly inside a class that is not a package.


3 Question

Is there something called a nonencapsulated package? If so, explain it.


3.1

Yes, there actually is. A nonencapsulated package is a package declared without the prefix encapsulated. Also large encapsulated packages, containing protected declarations, can be internally structured into nonencapsulated packages.


4 Question

Why might it be a problem to move packages?


4.1

That is because used declarations may not be available in the new location for that certain subclass. When copying or moving an encapsulated package or class at most the import statements inside this package or class, including subpackages and local classes, need to be updated.