Java – what are the benefits of using “import static”?
•
Java
What are the benefits of using "import static"?
Solution
In general, you should use the static import very sparingly
One of the places where they are very meaningful is in your unit test:
import static junit.framework.Assert.*;
Static imports are added to Java to prevent programmers from implementing constant interface antipattern
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码