Java File.getName()
Syntax
File.getName() has the following syntax.
public String getName()
Example
In the following code shows how to use File.getName() method.
/* w w w . j a va 2 s. com*/
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());
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »