The ‘Rare’ static imports

The static import declaration imports static members from classes, allowing them to be used without class reference.
 
for example:
import static java.lang.System.*;
class A
{
public static void main(String args[])
{
out.println("project code bank");
}
}

 
output:
project code bank
 
Note : Try to avoid this feature, because over a period you may not understand which static method or static attribute belongs to which class inside the java program. The program may become unreadable.
Rate this post

Leave a Reply