exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 21 discussion

Actual exam question from Oracle's 1z0-819
Question #: 21
Topic #: 1
[All 1z0-819 Questions]

A company has an existing Java 8 jar file, sales-app-1.1.1.jar, that uses several Apache open source jar files that have not been modularized.

Which module-info.java file should be used to convert sales-app-1.1.jar to a module?

  • A. module com.company.sales_app {
    requires commons.beanutils;
    requires org.apache.commons.collections4;
    requires org.apache.commons.lang3;
    requires org.apache.commons.text;
    }
  • B. module com.company.sales_app {
    requires org.apache.commons.beanutils;
    requires org.apache.commons.collections4;
    requires org.apache.commons.lang3;
    requires org.apache.commons.text;
    }
  • C. module com.company.sales_app {
    requires commons.beanutils;
    requires commons.collections4;
    requires commons.lang3;
    requires commons.text;
    }
  • D. module com.company.sales_app {
    requires commons.beanutils-1.9.3;
    requires commons.collections4-4.2;
    requires commons.lang3-3.8.1;
    requires commons.text-1.3;
    }
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ASPushkin
4 weeks, 1 day ago
Selected Answer: A
"module com.company.sales_app" underscore sign could be used in the module name (jls-7.7, jls-3.8) named modules still must explicitly require the automatic module. because the automatic module name for commons-beanutils-1.9.3.jar is not specified, then use the rules for name convertion : name is derived from the JAR file name the hyphens (-) will be replaced with dots (.). the .jar suffix is removed the version is also removed before the automatic module name
upvoted 1 times
...
d7bb0b2
6 months, 1 week ago
Selected Answer: A
A is correct, requires package name of automatic modules + requieres libname not modular and rules of nameconvention (remove - . and nro of version)
upvoted 1 times
...
Omnisumem
9 months ago
Selected Answer: B
tested: B
upvoted 1 times
...
ASPushkin
9 months ago
A. We assume that all files are on the module path. That means that automatic modules are generated for all of them. Otherwise, a named module cannot use them as a unnamed module in a requires directive. Then, we apply the rules for name convertion.
upvoted 1 times
...
lmocanasu
9 months, 3 weeks ago
Selected Answer: A
f commons.beanutils does not have an automatic-module-name, you should use the actual JAR file name as the module name. In that case, option A would be the correct one: A. module com.company.sales_app { requires commons.beanutils; requires org.apache.commons.collections4; requires org.apache.commons.lang3; requires org.apache.commons.text; } So, if commons.beanutils does not have an automatic-module-name, option A is the correct choice for modularizing the sales-app-1.1.1.jar file.
upvoted 2 times
...
aruni_mishra
10 months ago
When you use a non modular jar file as an automatic module, the name of the jar file is used to formulate the module name for that module. You need to know the following two basic rules while deriving this name from the file name: 1. The dashs are converted to dots and the version information and the file extension present in the file name are ignored. Therefore, for example, the module name for commons-beanutils-1.9.jar will be commons.beanutils. 2. If the jar file's manifest contains the Automatic-Module-Name entry, then that value is used as the module name (the name of the jar file is ignored completely). Therefore, in the given problem statement, module name for commons-collections4-4.0.jar will be org.apache.commons.collections4.
upvoted 2 times
aruni_mishra
10 months ago
hence "A" is correct module com.company.sales_app { requires commons.beanutils; requires org.apache.commons.collections4; requires org.apache.commons.lang3; requires org.apache.commons.text; }
upvoted 3 times
...
...
[Removed]
10 months, 3 weeks ago
Selected Answer: A
A is correct. Everybody seems to disagree but the last have a module name defined. So these will be chosen. The common-beanutils does not so it's jar file name will be stripped from its version number and the '-' will be replaced by a '.'
upvoted 2 times
...
Stavok
1 year ago
Selected Answer: B
The correct answer is B. The module-info.java file should specify the dependencies of the sales-app-1.1.jar module using the requires keyword. The names of the required modules should match the names specified by the Automatic-Module-Name entries in the manifest files of the Apache open source jar files. For example, commons-collections-4.4.2.jar specifies its module name as org.apache.commons.collections4, so the module-info.java file should include a requires org.apache.commons.collections4; statement. The commons-beanutils-1.9.3.jar file does not have an Automatic-Module-Name entry, so its module name is derived from its filename by removing the version number and replacing hyphens with dots, resulting in org.apache.commons.beanutils.
upvoted 4 times
...
Nayoumi
1 year, 1 month ago
Selected Answer: C
C is correct answer
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago