HOME      BLOG       FORUMS      CONTACT       ABOUT

Find the filename or directory name from a file object.

Find the filename or directory name from a file object.

The getName method of file class returns the name of the file or directory of the current file object.

import java.io.File;

public class FileExample {
public static void main(String[] args) {
File file = new File("d:\\temp");

System.out.println(file.getName());
}
}

Share

Tags: , , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply