Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

does import statement increase the size

 
Saurabh Dixit
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.
 
Steve McCann
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
 
Jacquie Barker
author
Ranch Hand
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic