• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

does import statement increase the size

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When we import a class in another class, does this increase the size of the java file in which we are importing the file. what kind of performance difference it causes.
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The import statement does nothing more than allow you to refer to a class without having to use the fully qualified name.
e.g.

or
 
author
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An import statement enables you to refer to a class by the shortened form of its name("ArrayList") versus having to refer to it via its fully qualified name ("java.util.ArrayList"). That is, the following two classes are equivalent:

Also note that the Java Virtual Machine's class loader is a "just in time" loader, meaning that it only loads the bytecode for a class into its memory when you first need it at run time -- i.e., the first time you instantiate an object of a particular type. Please see comments below.

I hope this helps!

Jacquie
 
Saurabh Dixit
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks jacquie and steve. My doubts have been cleared.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!