File.getName() has the following syntax.
public String getName()
In the following code shows how to use File.getName() method.
//from w w w . j a va2 s. co m import java.io.File; public class Main { public static void main(String[] args) throws Exception { // create new files File f = new File("c:/"); System.out.print(f.getName()); } }