Home > Java > javaTutorial > body text

Java implementation of obtaining file type and extension

高洛峰
Release: 2017-02-27 16:09:02
Original
1498 people have browsed it

Java获取文件的类型和扩展名

实现代码:

File file=new File("E:\\aa.jpg"); 
String fileName=file.getName();    
String fileTyle=fileName.substring(fileName.lastIndexOf("."),fileName.length()); 
System.out.println(fileTyle);
Copy after login

程序运行效果图:

Java implementation of obtaining file type and extension

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

更多Java implementation of obtaining file type and extension相关文章请关注PHP中文网!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!