954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Java Interview Question

Can one give a exat answer for this question

i have a java program with hundred packages imported but iam not using any one of them in program .i have only a SOP which prints hello world! .the qustion is will this program is thick with all the imported 100 packages ..Can anyone throw some light over here .. :D

thanks
Shyam

skoiloth
Newbie Poster
8 posts since Oct 2005
Reputation Points: 10
Solved Threads: 0
 

There's an easy way to find out. Compile the program with none of the imports and take note of the size (get the exact size, such as 3221 bytes rather than 3.2 kilobytes). Compile the program with many imports and take note of the size. Then compare the two sizes and see if there is any difference.

In my experience, declaring imports does nothing more than tell the compiler where search for class files that haven't been referred to by their full name. I can't say that this won't have any affect on the size of the byte file however, so I recommend that you check it out for yourself.

chrisbliss18
Posting Shark
917 posts since Aug 2005
Reputation Points: 38
Solved Threads: 25
 

What I'm wondering is why anyone would ask such a question during a job interview in the first place...
And if they did, why they'd put it in such terrible English.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

thanks chris
i compiled the java file with imports and with out imports . there is no size diff
Will import delay the compile time

skoiloth
Newbie Poster
8 posts since Oct 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You