0

I was in the middle of creating a project that involved Java's math package.

import java.math.BigDecimal;
import java.math.BigInteger;

And just as I was about to delete the second line and insert the * character in the first line:

import java.math.*;

I began to question if this method really is the better option. I imagine it makes very little difference in the overall scheme of the project, and it's very possible the compile would treat both versions of this import as being the same. If this isn't the case, however, then which is faster/more efficient?

Lee Presswood
  • 210
  • 2
  • 15
  • 2
    import is syntactic sugar. All it does is let you use a shorter version in the source code. On compilation, all classes are referenced via full package & class name, and the import statement is entirely removed – ControlAltDel Jul 30 '15 at 15:38
  • Specifying individual class imports is nicer for the **people** that have to read the code. Unless you're using an IDE that creates the imports for you, it's not worth the effort to maintain individual class imports. – Gilbert Le Blanc Jul 30 '15 at 16:12

0 Answers0