import java.io.RandomAccessFile; public class FileIOExample { public static void main(String[] args) { try { // Create a new RandomAccessFile object RandomAccessFile file = new RandomAccessFile("example.bin", "r"); // Read a single byte from the file and print it int byteValue = file.readByte(); System.out.println("Byte value: " + byteValue); // Close the file file.close(); } catch (Exception e) { e.printStackTrace(); } } }In this example, we create a new RandomAccessFile object for a file named "example.bin" in read-only mode. We use the readByte method to read a single byte from the file, and store its integer value in the variable byteValue. We then print out the value of byteValue to the console. Finally, we close the file using the close method. Package library: java.io