Use * is considered bad practice. It is used to import all files inside this package. A better way to do this is to list each of the classes that you need, especially in a scenario where you are viewing code outside of the IDE, and you need to know which version of the class you are using. Essentially, it creates laziness in the development team.
A comment
For those who claim that this is not a “bad” practice, as I said. How can you say this is good practice?
import java.util.*; import java.io.*;
Even if the compiler ignores everything under * except the imported List , how can this help someone to look at the code in the future? I think many people forget that you are writing code for people, not for computers. How could you convert this code when Java leaves and you use SuperAwesomeLanguage? In the following example, please convert this to a new language when you have a ZERO knowledge of java:
public class Foo { private List list; }
Is List in io ? io required? The problem is that you do not know. Therefore, being explicit, you can guide future developers as to which classes are needed.
source share