What About using import java.* for using all sub-packages under the package 'java'?

前端 未结 7 580
一生所求
一生所求 2021-01-13 19:06
import java.*;

Why cannot I do this importing ?? Instead of importing the all class in a particular sub-package of the package \'java\' , I tried t

7条回答
  •  生来不讨喜
    2021-01-13 19:58

    You can import java.util.* it work fine but when you import specific class instead of all class it take less time in importing but if you are importing too many classes from same package you can import all classes using package.* and it takes less time for jvm to fetch instead of taking one by one.

    By convention you can use import package.* if you are using too many classes from same package.

提交回复
热议问题