This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes importing packet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "importing packet" Watch "importing packet" New topic

importing packet

yashendra chandrakar

Joined: Mar 22, 2002
Posts: 22
if i m using only one class suppose java.util.Vector in my code but put import statement as
import java.util.*;
in place of
import java.util.Vector;
does it make any difference in performance or in any other way
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
During runtime you'll notice no difference whatsoever (the .class file wouldn't differ either) but during compile time the 'import java.util.*' makes the compiler drag in *all* classes from that package, ready to be scrutinized and inspected when needed, so some performance degradation would be noticable during compilation.
If you just need one or a couple of classes from a package it is considered 'well mannered' to explicitly import them instead of importing the entire package.
kind regards
It is sorta covered in the JavaRanch Style Guide.
subject: importing packet
Similar Threads
question about java import
My first interface
Excessive use of import wildcards
The == operator
what happens when i include a package more than once