If you need only one class from a package, eg ArrayList, you can write
import java.util.ArrayList;
. . .
ArrayListstudentNames; // same as above.
You might think that importing all classes from a package is inefficient, but there is no noticeable difference in my experience. Consequently most programs use the ".*" style of import.
No comments:
Post a Comment