Java获取文件后缀名

 public static void main(String[] args) {
        File file = new File("HelloWorld.java");
        String fileName = file.getName();
        String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
        System.out.println(suffix);
    }
原文地址:https://www.cnblogs.com/nongzihong/p/13920118.html