wood burning stoves 2.0
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
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
I agree. Here's the link: http://aspose.com/file-tools
subject: importing packet
It's not a secret anymore!