Table of Contents [hide]
If any class which is not in same package, we need to import it. If we import that class we can directly access static variables and methods with the class name.
If you use static import, you do not need to use class name any more.
Lets understand with the help of example
Without using static import :
With using static import :
Advantages:
If you have lot of static variables, you have to write less code.
Disadvantages:
It is very hard to read and unmaintainable.
Was this post helpful?
Let us know if this post was helpful. Feedbacks are monitored on daily basis. Please do provide feedback as that\'s the only way to improve.