File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " " Watch " " New topic

sandeep Talari
Ranch Hand

Joined: Dec 24, 2007
Posts: 63
can anybody help me regarding ,File class

this is the dought
how to make the directorys ,ok there were methods in File class named
boolean mkdir(),and boolean mkdirs().In Api its written under this method description is "Creates the directory named by this abstract pathname" what does it mean....

and there were methods like String[] list(), String[] listFiles(filefilter filter) under the description of these methods its written in Api that,"Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname" and " Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter" respectively please can anybody explain with small code piece and explain me the double coted sentences
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
Here's how to use the mkdir() in java:

As for the listFiles():

Google is a wonderful tool

Justin Fox

You down with OOP? Yeah you know me!
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

I think that Justin's answers are right, but I'd like to add that the difference between the methods:




is that the method: mkDir() will only one directory

whereas the method mkDirs() will make as many directories as needed to make the full-path valid.
I agree. Here's the link:
It's not a secret anymore!