When importing class libraries in Java if you use a wildcard (i.e. java.util.*) does this create security concerns since there are probably a bunch of libraries that are invoked that are not going to be used? Also will this slow down your program during execution? If not why don't we just always import every class?
Asked
Active
Viewed 78 times
1
-
For starter. Java makes it illegal to use java. as a custom package name or add your own classes to any java namespace (sigh) – Trash Can Sep 11 '16 at 18:39
1 Answers
1
- Libraries aren't "invoked". They're simply imported so the compiler knows which class you're referring to without using the fully qualified name
- It's a directive for the compiler, it has nothing to do with runtime performance
- If you imported every package, it would be useless, and classes with same names would then require you to use the FQN to determine which one you're referring to

Kayaman
- 72,141
- 5
- 83
- 121