which is true about the static import statement in java?1) It is used when one wants to use a class's static members.2)It is the same as import statement 3) when static import statement is used in a java source file,the classes declared in that file cannot declare any non-static members.4)The statement can be written either as static import of import static. It does not matter how it is written
Answers
Answer:
1
Explanation:
is the same as import statement 3) when static import statement is used in a java source file,the classes declared in that file cannot declare any non-static members
Explanation:
The static import feature of Java 5 facilitate the java programmer to access any static member of a class directly. There is no need to qualify it by the class name.
Advantage of static import:
Less coding is required if you have access any static member of a class oftenly.
Disadvantage of static import:
If you overuse the static import feature, it makes the program unreadable and unmaintainable.The import allows the java programmer to access classes of a package without package qualification whereas the static import feature allows to access the static members of a class without the class qualification. The import provides accessibility to classes and interface whereas static import provides accessibility to static members of the class.
#SPJ2