✪ Choose the correct option.
import java.io.*;
public class MyProgram {
public static void main(String args[]) {
FileOutputStream out = null;
try {
out = new FileOutputStream("test.txt");
out.write(122);
}
catch(IOException io) {
System.out.println("IO Error.");
}
finally {
out.close();
}
}
}
import java.io.*;
public class MyProgram {
public static void main(String args[]) {
FileOutputStream out = null;
try {
out = new FileOutputStream("test.txt");
out.write(122);
}
catch(IOException io) {
System.out.println("IO Error.");
}
finally {
out.close();
}
}
}
and given that all methods of class FileOutputStream, including close(), throw an IOException, which of these is true?