Is there a semantic difference between the following two options? Is any one of them more secure than the other in terms of automatic resource management?
Option1:
try ( ObjectInputStream in = new ObjectInputStream(new
FileInputStream("fooFile")) ) {
...
}
Option2:
try (FileInputStream fin = new FileInputStream("fooFile");
ObjectInputStream in = new ObjectInputStream(fin)) {
...
}