A

Admin • 825.56K Points
Coach

Q. What will be output for the following code?

Code:
import java.io.*;
class files
{
public static void main(String args[])
{
File obj = new File(""/java/system"");
System.out.print(obj.getName());
}
}
  • (A) java
  • (B) system
  • (C) java/system
  • (D) /java/system
  • Correct Answer - Option(B)
  • Views: 2
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
obj.getName() returns the name of the file.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.