I am using a function Map.entrySet(). When I am using import java.util.* it gives cannot find symbol error. But, when I am doing import java.util.Map.Entry it compiles. Shouldn't "*" include Map.Entry?
Am I missing anything?
Bottom line using import java.util.* gives me cannot find symbol error.
For the same code import java.Map.Entry; does not. Why?
Thank You.
The star import is used for importing all classes of the package. When you specify
You are denoting that all classes that have full name
java.util.<ClassName>are to be considered imported.java.util.Map.Entryis an inner class ofjava.util.Mapclass. The star import for sub-classes will be something like thisI can't say that it is a good practice to use start imports at all. Most of coding guidelines recommend to avoid it. Sub-class star imports isn't something you usually will come across in the code.