Home » JAVA Programming » Files and I/O » Question
  1. What is the output of this program?
    import java.io.*;
    public class files_Example
    {
    public static void main(String args[])
    {
    File object = new File("/New Folder/system");
    System.out.print(object.getParent());
    System.out.print(" " + object.isFile());
    }
    }
    1. /New
    2. Folder false
    3. /New false
    4. /New Folder false
    5. None of these
Correct Option: D

getparent() giver the parent directory of the file and isfile() checks weather the present file is a directory or a file in the disk



Your comments will be displayed only after manual approval.