Jan 03

This post is also available in: German

During program-execution it can also be checked weather we are dealing with a file or a folder. Let’s take the example of the last days again:

File folder= new File(“test_folder”);
folder.mkdir();
// creation of folder

File file = new File(folder, “Test.txt”);
try {
file.createNewFile();
}catch (IOException e) { }
// creation of file

check looks like this:

System.out.println(file.isFile()); // true
System.out.println(file.isDirectory()); // false
System.out.println(folder.isFile()); // false
System.out.println(folder.isDirectory()); // true

  • Print
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks
  • Add to favorites
  • RSS
  • Blogosphere
  • email
  • PDF
  • Wikio
  • Technorati
  • Digg
  • DZone

Leave a Reply

preload preload preload
http://www.wikio.de Blog Top Liste - by TopBlogs.de Blogverzeichnis - Blog Verzeichnis bloggerei.de Bloggeramt.de Software
Webbhotell Top Blogs