Ask Question

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

+5
Answers (1)
  1. 31 July, 20:23
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers