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.getName());
    }
    }

    1. new folder
    2. new folder/system
    3. /new folder/system
    4. system
    5. None of these
Correct Option: D

obj.getName() returns the name of the file.



Your comments will be displayed only after manual approval.