Given:
14. FileWriter fw1 = new FileWriter(new File("f1.txt")); 15. FileWriter fw2 = new FileWriter(new BufferedWriter(new PrintWriter("f2.txt"))); 16. PrintWriter pw1 = new PrintWriter(new BufferedWriter(new FileWriter("f3.txt"))); 17. PrintWriter pw2 = new PrintWriter(new FileWriter(new File("f4.txt")));
And given the proper imports and error handling, what is the result?
D is correct.
The code is using so-called "chained-methods" (or constructors) syntax.
The objects
fw1, pw1, and pw2 are created correctly.
The object
fw2 cannot be created because a FileWriter cannot be constructed using a BufferedWriter object.