8.12 static Import
In Section 6.3, you learned about the static
fields and methods of class Math
. We access class Math
’s static
fields and methods by preceding each with the class name Math
and a dot (.
). A static import declaration enables you to import the static
members of a class or interface so you can access them via their unqualified names in your class—that is, the class name and a dot (.
) are not required when using an imported static
member.
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.