Sail E0 Webinar
Question


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());
}
}
Options:
A .  java
B .  system
C .  java/system
D .  /java/system
Answer: Option B

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



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers