Java determine drive pathname
Java and pathname
Before i go through about file's operation, i want to share with you about "pathname" keyword. In java there has lot of methods play with pathname.
For example :
When we want to create a file instance like below
******************************************
File myFile=new File("c:\\mytext.txt");
******************************************
"c:\\mytext.txt" is a pathname for mytext.txt that locate in c drive.Origin for c:\\mytext.txt is c:\mytext.txt.We use two backslash to prevent syntax error when we compile it.
So, what is pathname ?
For example :
When we want to create a file instance like below
******************************************
File myFile=new File("c:\\mytext.txt");
******************************************
"c:\\mytext.txt" is a pathname for mytext.txt that locate in c drive.Origin for c:\\mytext.txt is c:\mytext.txt.We use two backslash to prevent syntax error when we compile it.
So, what is pathname ?
- A pathname is a string that describes what directory the file is in, as well as the name of the file.
Subscribe to:
Posts (Atom)