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 program compiles, but throws IOException because the file test.dat doesn't exist. The program displays IO exception.

Computer Science & Information Technology

You might also like to view...

By scrambling the contents of a file, you are using ________ to restrict access to the file

A) the Mark as Final command B) a Microsoft Account C) cloud computing D) encryption

Computer Science & Information Technology

You can set up a ____ between two tables so that you can use the fields from both tables in a query.

A. link B. bridge C. relationship D. bar

Computer Science & Information Technology

Which of the following should Matt, an administrator, change FIRST when installing a new access point?

A. SSID broadcast B. Encryption C. DHCP addresses D. Default password

Computer Science & Information Technology

A field width ________ be included in the format control string of the scanf statement.

a) can b) cannot c) must d) none of these

Computer Science & Information Technology