While working with files in java, if we try to get the name of a file which doesn't exist, using getName(), what will it return? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

While working with files in java, if we try to get the name of a file which doesn't exist, using getName(), what will it return?

If in a java program, i will create a file object named f1, and specify some path of the file in its constructor. And suppose, file doesn't exists at the specified path. if i will call the function to access the file name as f1.getName(); What value does the getName() function will return? What will be the output of this program?

18th Mar 2017, 4:14 AM
Vaishnavi Soni
Vaishnavi Soni - avatar
1 Answer
+ 2
Error
18th Mar 2017, 5:35 AM
Meharban Singh
Meharban Singh - avatar