Which set of commands is necessary to create and run a custom runtime image from Java source files?
A. java, jdeps
B. javac, jlink
C. jar, jlink
D. javac, jar
Given:
Which two allow a.Main to allocate a new Person? (Choose two.)
A. In Line 1, change the access modifier to private private Person() {
B. In Line 1, change the access modifier to public public Person() {
C. In Line 2, add extends Person to the Main class public class Main extends Person { and change Line 3 to create a new Main object Person person = new Main();
D. In Line 2, change the access modifier to protected protected class Main {
E. In Line 1, remove the access modifier Person() {
Which two statements are true about Java modules? (Choose two.)
A. Modular jars loaded from --module-path are automatic modules.
B. Any named module can directly access all classes in an automatic module.
C. Classes found in –classpath are part of an unnamed module.
D. Modular jars loaded from –classpath are automatic modules.
E. If a package is defined in both the named module and the unnamed module, then the package in the unnamed module is ignored.
Given: What is the expected result of javac?
A. javac fails to compile the class and prints the error message, C:\workspace4\Mycar.java:1:error: package java does not exist
B. javac compiles Mycar.java without errors or warnings.
C. javac fails to compile the class and prints the error message, C:\workspace4\Mycar.java:1:error: expected import java.lang
D. javac fails to compile the class and prints the error message, Error: Could not find or load main class Mycar.class
Given:
executed using command: java Hello "Hello World" Hello World What is the output?
A. An exception is thrown at runtime.
B. Hello WorldHello World
C. Hello World Hello World
D. Hello WorldHelloWorld
E. HelloHello WorldHelloWorld
Which two statements are correct about modules in Java? (Choose two.)
A. java.base exports all of the Java platforms core packages.
B. module-info.java can be placed in any folder inside module-path.
C. A module must be declared in module-info.java file.
D. module-info.java cannot be empty.
E. By default, modules can access each other as long as they run in the same folder.
Given:
What is the result?
A. b1
B. 2
C. b2
D. 1
E. b3
F. 3
G. The compilation fails due to an error in line 1.
Given the code fragment:
What is the output?
A. The compilation fails.
B. [-1, -2, -3]
C. [-3, -2, -1]
D. A runtime exception is thrown.