Java File Extension Name Get getFileExtension(File file)

Here you can find the source of getFileExtension(File file)

Description

Return the file extension.

License

Open Source License

Parameter

Parameter Description
file the file

Return

The file extension.

Declaration

public static String getFileExtension(File file) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    /**//from   ww  w  . j  a va 2s  . c  o  m
     * Return the file extension.
     * @param file the file
     * @return The file extension.
     */
    public static String getFileExtension(File file) {
        return file.getName().substring(file.getName().lastIndexOf(".") + 1);
    }
}

Related

  1. getFileExtension(File f)
  2. getFileExtension(File f)
  3. getFileExtension(File file)
  4. getFileExtension(File file)
  5. getFileExtension(File file)
  6. getFileExtension(File file)
  7. getFileExtension(File file)
  8. getFileExtension(File file)
  9. getFileExtension(File file)