For Java, can I import all packages at once?

For example, a third-party library uses a very complex directory structure for the package. Can I import them immediately. A star can import only one level of the catalog.

+5
source share
6 answers

Assuming you ask if you can do something like:

import com.example.*;
// expecting packages like com.example.foo.* and com.example.bar.* to be imported

Then the answer is no . The biggest import you can make is a single package with a star.

JLS (section 7.5) defines the structure for import statements.

, . , , , . JLS 6.5.5.1:

, - , ; .

+14

java, " ", "*"

Eclipse, , , : CTRL + SHIFT + O:) - IDE .

+3

, , " " IDE ( java IDE ).

, "*" , . - ( jdk), - ( ). , , - , , .

(, ... , , .)

.: D

+3

JSP, .inc java

0

.

IntelliJ Ctrl + Alt + O :

  • .

" → → → "

0

:

   import java.*;
   import javax.*;

*

   java.*;

java.

0

All Articles