Java Reference
In-Depth Information
In this version, the names
sqrt
and
pow
are brought into view by these static import state-
ments:
After these statements, it is no longer necessary to qualify
sqrt( )
or
pow( )
with its class
name. Therefore, the expression can more conveniently be specified, as shown here:
As you can see, this form is considerably shorter and easier to read.
There are two general forms of the
import static
statement. The first, which is used by
the preceding example, brings into view a single name. Its general form is shown here: