What happens if the file test.dat does not exist when you attempt to compile and run the following code?

```
import java.io.*;

class Test {
public static void main(String[] args) {
try {
RandomAccessFile raf =
new RandomAccessFile("test.dat", "r");
int i = raf.readInt();
}
catch(IOException ex) {
System.out.println("IO exception");
}
}
}```
a. The program does not compile because raf is not created correctly.
b. The program does not compile because readInt() is not implemented in RandomAccessFile.
c. The program compiles, but throws IOException because the file test.dat doesn't exist. The program displays IO exception.
d. The program compiles and runs fine, but nothing is displayed on the console.


c The problem is in line: new RandomAccessFile("test.dat", "r"); Because the file does not exist, you cannot open it for reading.

Computer Science & Information Technology

You might also like to view...

Answer the following statements true (T) or false (F)

1. Command line arguments are passed to the program in positional variables. 2. The positional variable $# contains the number of command line parameters. 3. The if construct is used to detect syntax errors in script files. 4. The while and until constructs are used to repeat a set of instructions in a script file. 5. The for construct is used to forward commands to another script file.

Computer Science & Information Technology

_____ limitations result when a system that was designed for a specific hardware configuration becomes obsolete when new hardware is introduced.?

A. ?Accessibility B. ?Relationship C. ?Feasibility D. ?Performance

Computer Science & Information Technology

If you assume a technical web design role, your focus primarily will be on how the website looks, and its content.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

After a few users report problems with the wireless network, a system administrator notices that a new wireless access point has been powered up in the cafeteria. The access point has the same SSID as the corporate network and is set to the same channel as nearby access points. However, the AP has not been connected to the Ethernet network. Which of the following is the MOST likely cause of the user's wireless problems?

A. AP channel bonding B. An evil twin attack C. Wireless interference D. A rogue access point

Computer Science & Information Technology