获取文件的文件类型名称
import java.io.File; import javax.swing.JFileChooser;/*来 自 时代Java*/ public class Main { public static void main(String[] argv) { JFileChooser chooser = new JFileChooser(); // Create a File instance of the file File file = new File("filename.txt"); // Get the file type name String fileTypeName = chooser.getTypeDescription(file); System.out.println(fileTypeName);/** from nowjava.com - 时代Java**/ // Text Document } }