What is the correct way to close a file in Java after writing to it?

PYQ RPSC Programmer 2024

What is the correct way to close a file in Java after writing to it?

  1. A.

    fileInput.close();

  2. B.

    file.close();

  3. C.

    fileWriter.close();

  4. D.

    fileStream.close();

  5. E.

    Question not attempted

Attempted by 437 students.

Sign up free to check your answer

Sign up free

Explore the full course: Rpsc Programmer

Loading lesson…