This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes java.io Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java.io " Watch "java.io " New topic
Author

java.io

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:

mkDir();

and

mkDirs();

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.
 
GeeCON Prague 2014
 
subject: java.io