Decoding Java FileInputStream usage

Report a typo

What are the correct ways to use input streams in Java to read data from a file and store it in a byte array? Consider the following code snippet:


import java.io.*;

public class ReadData {
    public static void main(String[] args) throws IOException {
        File file = new File("input.txt");
        byte[] bytesArray = new byte[(int)file.length()];
        // What is the correct line of code to place here?
    }
}
Select one or more options from the list

Create a free account to access the full topic