File Constructors Explanation
I Was Unable to Understand the Following File Constructors. Public File(String Parent, String Child) and Public File(File Parent, String Child) What Do the...
I was unable to understand the following file constructors.
public File(String parent, String child) and
public File(File parent, String child)
What do the parameters parent and child mean for the file? When can I use these? I have done few programs related to file but I have never used these. I usually use
public File(String pathname)
I have read Javadoc but I could not figure out when and how to use these constructors. Could someone please explain and give examples.
4 Answers
Must Read
Explanation
The parent parameter is the parent directory of the child file name or relative file path.
Where parent is a File instance, it is a directory file. Where parent is a String, it's simply that directory in pathname terms.