Ask Question
10 April, 13:01

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

+4
Answers (1)
  1. 10 April, 14:01
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers