aspose file tools*
The moose likes Beginning Java and the fly likes importing unnecessary classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "importing unnecessary classes" Watch "importing unnecessary classes" New topic
Author

importing unnecessary classes

Lucas Franceschi
Ranch Hand

Joined: Nov 10, 2008
Posts: 106

importing unnecessary classes, does it makes my program run slowly or use more memory?

i mean, is it any bad to import classes that i don't use?


Lucas Franceschi
Software Developer for SGI Sistemas, lukas1596@gmail.com
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39544
    
  27
It has no impact at runtime, it's just a compile-time convenience.


Ping & DNS - updated with new look and Ping home screen widget
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10909
    
  12

import statement are not like c-style 'includes'. They are kind of like a PATH variable for the file. they tell the compiler "if you can't figure out what the 'Person' class is, try looking for it in the 'org.mycompany.people' package" - and since package structures are basically a list of directories...


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: importing unnecessary classes
 
Similar Threads
Unable to compile class for JSP
import package performance
import pkg.* vs. import pkg.class
Why do we need static nested class?
Is import java.util.List faster than java.util.*