Why is using a wild card with a Java import statement bad?

后端 未结 17 1967
梦谈多话
梦谈多话 2020-11-21 13:07

It is much more convenient and cleaner to use a single statement like

import java.awt.*;

than to import a bunch of individual classes

17条回答
  •  耶瑟儿~
    2020-11-21 13:50

    Performance: No impact on performance as byte code is same. though it will lead to some compile overheads.

    Compilation: on my personal machine, Compiling a blank class without importing anything takes 100 ms but same class when import java.* takes 170 ms.

提交回复
热议问题