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


Recommended Answers

All 3 Replies

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.

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.