Loading topic
import declarations. You don't need prior module experience. This chapter covers the parts of the module system that import module builds on.6 min readimport module, what the compiler does with it, and how to compile and run code that uses it. You should be comfortable with single-type imports (import java.util.List;) and on-demand imports (import java.util.*;), and know what a package and a fully qualified 7 min readmodule-info.java with exports and requires directives. The previous chapter introduced the syntax import module java.base;. This chap5 min readimport java.util.List;) and on-demand imports (import java.util.*;) work, and what a fully qualified name is. You should have seen import module java.base; from the previous chapt6 min readimport module once, as in import module java.base;. You don't need to have written a module-info.java file. The chapter explains the one directiv6 min readimport java.util.List;), on-demand imports (import java.util.*;), and the import module declaration from earlier chapters. It covers what happens when several declarations in scope use the same simple name. You will learn which declaration win6 min readimport java.util.List; and import java.util.*;. A rough idea of module-info.java helps. The earlier chapters covered what import module M; imports and how name clashes are resolved. This one cov6 min read--release does. It also assumes you have read the earlier chapters on the import module syntax. The focus here is the toolchain. You will see which JDK versions accept import module, which flags each one need6 min readimport module declaration for you. It assumes you know single-type and on-demand imports, can compile and run a Java class from the command line, and have read the earlier chapters on the import module syntax and on name ambiguity. You don't6 min readimport module and know that ambiguity is reported only when a name is used. Earlier chapters covered the syntax, ambiguity and shadowing. Here we turn that mechanics into decisions: where a module import6 min read