Java Reference
In-Depth Information
Ask the Expert
Q :
Using static import, can I import the static members of classes that I create?
A : Yes, you can use static import to import the static members of classes and interfaces
you create. Doing so is especially convenient when you define several static mem-
bers that are used frequently throughout a large program. For example, if a class
defines a number of static final constants that define various limits, then using static
import to bring them into view will save you a lot of tedious typing.
Annotations (Metadata)
Java provides a feature that enables you to embed supplemental information into a source
file. This information, called an annotation , does not change the actions of a program.
However, this information can be used by various tools, during both development and de-
ployment. For example, an annotation might be processed by a source-code generator, by
the compiler, or by a deployment tool. The term metadata is also used to refer to this fea-
ture, but the term annotation is the most descriptive, and more commonly used.
Annotation is a large and sophisticated topic, and it is far beyond the scope of this topic
to cover it in detail. However, an overview is given here so that you will be familiar with
the concept.
NOTE
A detailed discussion of metadata and annotations can be found in my book Java: The
Complete Reference, Ninth Edition (Oracle Press/McGraw-Hill Professional, 2014).
An annotation is created through a mechanism based on the interface . Here is a simple
example:
Search WWH ::




Custom Search