Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Monday, November 19, 2007

Importing each java class explicitly

If you need only one class from a package, eg ArrayList, you can write

import java.util.ArrayList;
. . .
ArrayList studentNames; // 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

Archives