Ask Question
13 December, 12:39

If the IOData. dat file does not exist, what will happen when the following statement is executed? RandomAccessFile randomFile = new RandomAccessFile ("IOData. dat", "rw");

+2
Answers (1)
  1. 13 December, 13:29
    0
    Creates the file with the given file name.

    Explanation:

    Here, the constructor is RandomAccessFile randomFile = new RandomAccessFile ("IOData. dat", "rw"); The general form to construct the object of RandomAccessFile class is RandomAccessFile randomFile = new RandomAccessFile (String Filename, String mode); Here, the String Filename is the filename of the file that has to executed with the String mode. The modes decide the accessibility of the file, types like r - 'read only' the file, rw - 'read and write' the file. If the file doesn't exists it creates the file with the given filename. If a file with read only mode is tried to write in the file, then it throws exceptions.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “If the IOData. dat file does not exist, what will happen when the following statement is executed? RandomAccessFile randomFile = new ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers