πŸ“Š JAVA
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
πŸ’¬ Discuss
βœ… Correct Answer: (B) system

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

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

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
160
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Geetam
Publisher
πŸ“ˆ
98%
Success Rate