Import statements
9. Import statements
9.1. Usage of import statements
You have to access a Java class always via its full-qualified name, i.e., the package name plus a . followed by the class name.
You can add import
statements into your class file. These allow you to use the related classes in your code without the package qualifier.
9.2. Static imports
Static import allows public static
members (fields and methods) of another class to be used in Java code without a class reference.
The feature provides a typesafe mechanism to include constants into code. It also improves code readability and allows Java API designers to write a concise API.
Comments
Post a Comment