Can't we import whole package rather than importing each classess? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can't we import whole package rather than importing each classess?

that is using import java.util.*; rather than import java.util.Iterator; import java.util.LinkedList; Are we making the program more complex when we import the whole package?

7th Mar 2017, 6:47 AM
SHIBIN SIMON THOMAS
SHIBIN SIMON THOMAS - avatar
1 Answer
+ 13
The program will not be more complex and not even bigger. The import declaration just tells the compiler: If you don't find a class in this package, search for them at the path that is declared after import.
7th Mar 2017, 7:06 AM
Tashi N
Tashi N - avatar