Toggle nav
What is the output of this program?
import java.io.*; class files { public static void main(String args[]) { File obj = new File("/java/system"); System.out.print(obj.getName()); } }
Answer : Option B
Explanation :
obj.getName() returns the name of the file.
isFile() returns true if called on a file and returns false when called on a directory.
Answer : Option C
Answer : Option A
A File describes properties of a file, a File object is used to obtain or manipulate
the information associated with a disk file, such as the permissions, time date,
and directories path, and to navigate subdirectories.