which two (three?) code fragments create a one-byte file?

Assuming the port statements are correct, which two (three?) code fragments create a
one-byte file?

Assuming the port statements are correct, which two (three?) code fragments create a
one-byte file?

A.
OutputStream fos = new FileOutputStream(new File(“/tmp/data.bin”)); OutputStream bos
= new BufferedOutputStream(fos); DataOutputStream dos = new DataOutputStream(bos);
dos.writeByte(0); dos.close();

B.
OutputStream fos = new FileOutputStream (“/tmp/data.bin”); DataOutputStream dos =
new DataOutputStream(fos); dos.writeByte(0); dos.close();

C.
OutputStream fos = new FileOutputStream (new File (“/tmp/data.bin”));
DataOutputStream dos = new DataOutputStream(fos); dos.writeByte(0); dos.close();

D.
OutputStream fos = new FileOutputStream (“/tmp/data.bin”); fos.writeByte(0); fos.close();

Explanation:



Leave a Reply 0

Your email address will not be published. Required fields are marked *