Working with file data in Java

Report a typo

In the given incomplete program where a File instance is created, information such as the path, along with its read and write privileges are obtained. Can you fill the blanks in the code so that it correctly displays this information? Remember, you're only allowed to use the features and concepts of Java you've learned so far.

Fill in the gaps with the relevant elements
import java.io.;

public class CheckFileProperties {
    public static void main([] args) {
        File  ();
        String   +
            "\nFile path: " + tempFile +
            "\nFile is readable: " + tempFile +
            "\nFile is writable: " + tempFile;
            
        (fileInfo);
    }
}
= new FileSystem.getAbsolutePath()tempFileFile.canWrite().exists().out.print.canRead()StringfileInfo= "File exists: " + tempFile"tempFile.txt"

Create a free account to access the full topic