47.7k views
5 votes
Which of the following statements can correctly create a DataOutputStream to write to a file named out.dat? Select all that apply.

User Cephus
by
8.0k points

1 Answer

4 votes

Answer:

Options are missing (Incomplete Question)

Explanation:

One of the ways to create a DataOutputStream to write a file named out.dat is

FileOutputStream file = new FileOutputStream(D:\\out.dat);

DataOutputStream data = new DataOutputStream(file);

Line 1 declares a file variable to prepare the out.dat file for operation.

The file is located at directory D (Other location can also be used)

Line 2 creates a DataOutputStream variable named data to create the file named out.data in the directory mentioned above.

User Gaperton
by
6.6k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.