File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes importing entire package or just needed classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

importing entire package or just needed classes

JohnV Varghese

Joined: Oct 09, 2003
Posts: 7
Which is better
import java.util.*;
import java.util.List;
with respect to performance!!!
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
There is no difference in performance.
A Java import only comes into play at compile time, and then ONLY the required classes are pulled in. This makes it somewhat different from a C++ include which pulls everything in.
With that said, for production classes many shops insist that you name the exact classes that you want imported for documentation purposes.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Please don't post the same question in multiple forums. It takes time for people to answer, which is wasted if the poster doesn't realize the question has already been aswered elsewhere. Followups can go here. Thanks.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: importing entire package or just needed classes
It's not a secret anymore!