Is loading only the needed classes directly a good way of reducing the overall memory usage of a Java application?
For example:
import java.awt.Graphics;
vs
import java.awt.*;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. You should import only the needed classes to make it clear to programmers which classes are actually needed by your class.
Import statements just tell the compiler where to look for the classes you are using – it doesn’t mean all the classes in the package are loaded into memory.