Which of the following statements are correct?
```
I:
File file = new File("input.txt");
try (Scanner input = new Scanner(file)) {
String line = input.nextLine();
}
II:
try (File file = new File("input.txt");
Scanner input = new Scanner(file);) {
String line = input.nextLine();
}
III:
File file;
try (file = new File("input.txt");
Scanner input = new Scanner(file);) {
String line = input.nextLine();
}
IV:
File file;
Scanner input;
try (file = new File("input.txt");
input = new Scanner(file);) {
String line = input.nextLine();
}```
a. I
b. II
c. III
d. IV
a File is not a subtyp of AutoCloseable. So it cannot be used to open a resource in a try-with-resources.
You might also like to view...
One of the below programs that when called like this (with the underscore representing a digit from 1 to 4) generates this output:
``` >>> dup_("rubber duck") ’kcud rebburrubber duck’ ```
A firewall that blocks a Telnet session from leaving the network over TCP port 443 uses which of the following?
a. Stateful inspection b. Stateless inspection c. Low-level inspection d. Application layer inspection
Joe, a customer, is looking to implement wireless security. Which of the following provides the WEAKEST encryption?
A) SSH B) WEP C) EAP D) TLS
A(n) ____ is a programmer-defined type, such as a class.
A. inheritance B. numeric data type C. primitive data type D. abstract data type