When I started to learn Java, I read that the form for using the import statement should be the following:

import package1 [.pack2]. (class name | *);

Those. either the whole package or a class can be imported, for example:

 import java.util.Date; import java.io.*; 

And today I first saw the following imports:

 import static org.apache.commons.lang.StringUtils.isNotBlank; 

Since when did the opportunity to import methods appear in java ? Was it always like this, or did it appear in one of the latest versions?

  • 3
    With 1.5 , it can be said that it always has been. - zRrr
  • @zRrr, thanks for the link! Apparently, I missed a static import somewhere) - Ksenia

1 answer 1

This design is called static import. Appeared from 5 java, below you can read about it:

https://docs.oracle.com/javase/1.5.0/docs/guide/language/static-import.html