How do wildcards in Java import work?
import, java, syntax
Solution
`import java.util.*` definitely imports `java.util.ArrayList` and everything else in that package too. Note that there's no concept of sub-packages, so it wouldn't import anything from `java.util.x` or `java.util.y`, but that doesn't appear to be the case with your issue.
You must have some other problem wrong with your code if it's not working, the import statements definitely behave as you describe.
Problem
I've been noticing some unexpected results with my `import`s, and I'm hoping to understand what's really going on. I started with the following: ``` import java.util.*; import java.io.*; import java.nio.*; import java.nio.file.Path; import java.nio.file.StandardOpenOption.*; import java.nio.file.Paths; ``` and then found that `ArrayList` and `ListIterator` didn't work...so I added ``` import java.util.ArrayList; import java.util.ListIterator; ``` and everything works perfectly. I would have assumed that `java.util.*` would have also imported `ArrayList` and `ListIterator`. Why didn't it? I've a tendency to be overly verbose with my class/method/variable names, and I didn't find anything in the rest of the program that was even close to a reserved word. I can't find anything in the documentation that suggests why this would occur, and most of the discussion on Stack is about optimaztion using * vs. explicitly coded imports. Anyone have any ideas what else I can look at to get an understanding of this behavior?