Given the code fragment:
public static void main(String[] args) {
Path dir = Paths.get("d:\\company");
// insert code here. Line **
for (Path entry: stream) {
System.out.println(entry.getFileName());
}
} catch (IOException e) {
System.err.println("Caught IOException: " + e.getMessage()); }
}
Which two try statements, when inserted at line 11, enable you to print files with the extensions.java, .htm, end and .jar.
Given the code fragment:
Locale loc1 = Locale.getDefault ();
ResourceBundle messages = ResourceBundle.getBundle("MessageBundle", loc1);
Which two statements are a valid way to re-assign a resource bundle to a different Locale?
Given:
public class TemperatureSensor {
public TemperatureSensor () {
}
public double getCurrTemp () {
// . . . method to retrieve temperature from a sensor
Return temp;
}
}
Which three changes should you make to apply the singleton design pattern to this class?