java - What will the following import declaration import? -


java.io.reader.*; 

i know reader class, not package.

so, above declaration import?

the declaration:

import java.io.reader.*; 

is example of type-import-on-demand declaration. java language specification:

a type-import-on-demand declaration allows accessible types of named package or type imported needed.

since java.io.reader contains no nested classes or other accessible types, declaration ignored.

note java has import static declaration. so

import static java.io.reader.*; 

would example of static-import-on-demand declaration. again, according java language specification:

a static-import-on-demand declaration allows accessible static members of named type imported needed.

and since java.io.reader has no accessible static members, declaration again ignored.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -