简体   繁体   English

如何获取文件名及其路径?

[英]how do I get filename and it's path?

I just wanted to know how do I get the file's name and path using the java.io.File.我只是想知道如何使用 java.io.File 获取文件的名称和路径。 is there any function which does it or should i do it manually?有没有 function 可以做还是我应该手动做?

You can get the name and path of the file by using the getName() and getPath() methods.您可以使用getName()getPath()方法获取文件的名称和路径。 ( Documentation ) 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM