Which is true?
-
The java command can access classes from more than one package, from a single JAR file.
-
JAR files can be used with the java command but not with the javac command.
-
In order for JAR files to be used by java, they MUST be placed in the /jre/lib/ext sub-directory within the J2SE directory tree.
-
When a part of a directory tree that includes subdirectories with files is put into a JAR file, all of the files are saved in the JAR file, but the subdirectory structure is lost.
The java and javac commands can access classes from JAR files specified in the classpath. A single JAR file can contain classes from multiple packages. Option A is correct. Options B and C are incorrect (javac uses JARs, and they don't need to be in ext). Option D is incorrect (directory structure is preserved).
A single JAR file can bundle classes from multiple packages (the package structure is simply mirrored as directories inside the JAR), and the java command can load and run classes from such a JAR via the classpath. JARs work with both java and javac (for compiling against classes in the JAR), don't have to sit in /jre/lib/ext to be used via the classpath, and preserve subdirectory structure rather than flattening it.