How to get file name in java code, example

 public static String getFileName(String filePath)
    {
        File f = new File(filePath);
        return f.getName();
    }