which element of the array does this expression reference num[5]
115 Num5
1.) Odd Number 2.) Prime Number 3.) And a few others - richardphillips.org.uk/number/Num5.htm
Byte StreamsIf a program needs to read/write bytes (8-bit data), it could use one of the subclasses of the InputStream or OutputStream respectively. The example below shows how to use the class FileInputStream to read a file named abc.dat. This code snippet prints each byte's value separated with white spaces. Byte values are represented by integers from 0 to 255, and if the read() method returns -1, this indicates the end of the stream.import java.io.FileInputStream;import java.io.IOException;public class ReadingBytes {public static void main(String[] args) { FileInputStream myFile = null; try {myFile = new FileInputStream("c:\\abc.dat"); // open the streamboolean eof = false;while (!eof) {int byteValue = myFile.read(); // read the streamSystem.out.println(byteValue);if (byteValue == -1){eof = true;}//myFile.close(); // do not do it here!!!}}catch (IOException e) {System.out.println("Could not read file: " + e.toString());} finally{try{if (myFile!=null){myFile.close(); // close the stream}} catch (Exception e1){e1.printStackTrace();}}}}Please note that the stream is closed in the clause finally. Do not call the method close() inside of the try/catch block right after the file reading is done. In case of exception during the file read, the program would jump over the close() statement and the stream would never be closed!The next code fragment writes into the file xyz.dat using the class FileOutputStream:int somedata[]={56,230,123,43,11,37};FileOutputStream myFile = null;try {myFile = new FileOutputStream("c:\xyz.dat");for (int i = 0; i BufferedInputStream --> DataInputStreamFileInputStream myFile = new FileInputStream("myData.dat");BufferedInputStream buff = new BufferedInputStream(myFile);DataInputStream data = new DataInputStream(buff);try {int num1 = data.readInt();int num2 = data.readInt();float num2 = data.readFloat();float num3 = data.readFloat();float num4 = data.readFloat();double num5 = data.readDouble();} catch (EOFException eof) {...}