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

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

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