Question 1
Given the code fragment:
Which two try statements, when inserted at line ***, enable you to print files with the extensions.java, .htm, and .jar.
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir,"*.{java,htm,jar}")){
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir,"*. [java,htm,jar]")) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir,"*.{java*,htm*,jar*}")) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir,"**.{java,htm,jar}")) {
Correct answer: AD
Explanation:
"*. {java,htm,jar} and"**. {java,htm,jar} will match any file with file endings java, htm, or jar.
"*. {java,htm,jar} and
"**. {java,htm,jar} will match any file with file endings java, htm, or jar.