0

[ANSWERED]Importing

Is it a gpod practice to import everything inside the package like import java.util.*; or is it better to specify import java.util.ArrayList;

10th Apr 2017, 1:50 PM
Alex Snaidars
Alex Snaidars - avatar
3 Respostas
+ 2
It is generally not a good practice to import everything from a package. This way when the application​ is compiled, your application​ size will be a lot bigger, because you have unnecessary imported classes.
10th Apr 2017, 6:27 PM
Hassie
Hassie - avatar
+ 3
actually there is no difference, but its better to specify imports because lets say you import java.util.* then if you use another class which has the same name as one of the class in java.util that you don't use then u have to use the full name of this class everywhere in ur code,which is bad for readability.
10th Apr 2017, 2:06 PM
Haileyesus Shitalem
Haileyesus Shitalem - avatar
+ 1
Isn't the program overloaded with unnecessary imported methods in this case? Doesnt that cause lagging or something?
10th Apr 2017, 5:34 PM
Alex Snaidars
Alex Snaidars - avatar