SCJP
Visit my download page
Yes , It will return "false" since the path is not valid.
Try to change the file object String of 'junk' to valid path of directory "temp".
3. for mkdir() method, I do not know how to use it actually, so just try it as it is. And I failed to create any directory in my disk. I hope someone could please explain how this method actually works.
This is same as the above case,also the String must be a directory name not a file name.
Here change the String of file object 'F7' to a valid directory path.
example : File f7=new File("d:\\ttt");
1. after I add getCanonicalPath(), I got error message as "java.io.IOException must be caught, or it must be declared in throw clause�" no idea about what is going on.
The signature of getCanonicalPath(), is
public String getCanonicalPath()throws IOException
So the method call must be declared in a try-catch block.
2. For method list(), when I call f1.list(), I got some strange codes but not a list of directory as I expected. Never use it before, can somebody tell me how to use it?
signature of File.list() is
public String[] list()
Returns an array of strings naming the files and directories in the directory
So
" f1.list() " Returns an array and what printed out is the HashCode value of that array.
To get the content of the array reurned by " f1.list() " try this
Hope this may help...
Rosemol
Don't get me started about those stupid light bulbs. |