This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
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
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

importing entire package or just needed classes

JohnV Varghese
Greenhorn

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

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
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18670
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: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: importing entire package or just needed classes
 
Similar Threads
Document to String
classpath issue
WA #1.....word association
ODBC and xBase
include class in other file?