Essay
import java.nio.file.*;
import java.io.*;
import static java.nio.file.StandardOpenOption.*;
public class WriteFile
{
public static void main(String[] args)
{
Path myFile = Paths.get("C:\\Java\\Input.Output\\myNumbers.txt");
String nums = "12345";
byte[] data = nums.getBytes();
OutputStream output = null;
try
{
-----Code here------
output.write(data)
output.flush();
output.close();
}
catch(Exception badNums)
{
System.out.println("My numbers: " + badNums);
}
}
}
Using the above code, add a statement on the indicated line that will create a writeable file by constructing a BufferedOutputStream object and assigning it to the OutputStream . No output should appear on the monitor, but a file should be created.
Correct Answer:

Verified
output = new Buffere...View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q1: Permanent storage is usually called computer memory
Q2: InputStream and OutputStream are subclasses of the
Q3: The value you store in memory is
Q4: Describe and provide an example of the
Q5: When a String is written, placing each
Q7: How can you categorize files by the
Q8: In random access files, records can be
Q9: FileSystems is a class that contains _
Q10: When you perform input and output operations
Q11: The _ method returns the last Path