Answer:
PrintWriter out = new PrintWriter(new File("myOutput.txt"));
Step-by-step explanation:
PrintWriter object is used to create an abstraction to a File for writing purpose.
PrintWriter constructor with File object input takes one of the two forms:
- PrintWriter(File,String).
Among the given options, option 4 corresponds to PrintWriter object creation using the first version of PrintWriter constructor.
So the valid option that declares a PrintWriter object for an output file 'myOutput.txt' is:
PrintWriter out = new PrintWriter(new File("myOutput.txt"));