C4 - Lesson 4: Java Modules Flashcards

1
Q

export

A

exports: Identify a package that should be available to users of this module. Takes a package name as a parameter. Does not include subpackages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

requires

A
  • requires: Make the packages in the specified module available in this module. You cannot require a package that also requires you
  • Is like the import
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

module descriptor

A
  • it is the modules-info.java
  • module name
    indicates which packages the module makes available, as well as which modules this module relies on
  • has the “module” keyword
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

modules

A
  • Is a jar

- They also contain one additional class called a module descriptor modules-info.java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

MODULEPATH

A
  • you place your modules at a different location, called the MODULEPATH.
  • This is the path where the compiler looks for all your modules.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

to

A

The to keyword can be used to modify exports to limit which modules can access the specified package.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

transitive

A

The transitive keyword modifies the requires keyword and specifies that the required module will also be made available to any other module that includes this module.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

reflection access.

A

,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

CLASSPATH

A
This is the path where the compiler looks for all your class files.
- Before java 9 building a Java project involved placing all project classes and jars on the CLASSPATH
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What happens in java 9+ if something does not use modules?

A
  • All Java applications compiled in Java 9+ use the module system
  • Even if they contain no modules and do not use a module descriptor, everything placed on the CLASSPATH are placed into what is called the Unnamed Module.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Named, Unnamed and automatic modules: Access comparasion

A
  • Named: Named and automatic
  • Unnamed: Unnamed and automatic
  • automatic: Named and Unnamed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Classpath and modulepath in maven

A

Modulepath

  • Modular jars
  • Nonmodular dependencies. This become automatics module with same name
  • Transitive dependencies that are modules

Classpath
- Transitive dependencies that are not modules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

open

A

opens: Makes the specified package available for both public and private class reflection access. Can optionally use the to keyword to limit which modules have this access.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly