Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

imports

 
Arvind Chavar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does wildcard imports of packages place any performance penalties as compared to only importing required classes?
Arvind
 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe so. They are all aliases.
-Dale
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dale is correct.
import statements have no affect what so ever on performance.
u can put as many as u want including as many wildcards as u want and it wont affect it one bit.
import staments only help us typing out the name of the class instead of the FULL name inlcuding the package.
however, u should note that using wildcards is not recommended for a diffrent reason: it may cause class name clashes in your pgram and make it sometimes harder to understand.
 
Arvind Chavar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dale and Roy ,Thanks!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic