java中file的getPath(),getAbsolutePath(),getCanonicalPath()的比较
来源:互联网 发布:python画爱心 编辑:程序博客网 时间:2024/06/03 21:26
getPath()会得到file构造函数参数的值;
getAbsolutePath()当参数为相对路径时会得到文件的绝对路径+相对路径,当参数为绝对路径时直接得到绝对路径;
getCanonicalPath()当参数为相对路径为得到文件的绝对路径,当参数为绝对路径时得到文件的绝对路径。
getPath(),getAbsolutePath()不能实际分析磁盘中的文件,只是根据构造函数的参数来进行路径解析,但getCanonicalPath()会结合磁盘中的文件进行解析。究其原因其实是windows系统文件对大小写不敏感,也就是说在windows上a.txt 和A.txt是一个文件,所以当文件存在时,就会按照实际的情况来显示。而在linux系统是大小写敏感的。ps:朋友们可以试一下把盘的名字改成小写的d,看看输出结果
0 0
- java中file的getPath(),getAbsolutePath(),getCanonicalPath()的比较
- JAVA中file的getPath getAbsolutePath和getCanonicalPath的不同
- Java 中 File.getPath() getAbsolutePath()和getCanonicalPath()的不同
- java中File类的getPath(),getAbsolutePath(),getCanonicalPath()区别
- java中File类的getPath(),getAbsolutePath(),getCanonicalPath()区别
- java中File类的getPath(),getAbsolutePath(),getCanonicalPath()区别
- java中File类的getPath(),getAbsolutePath(),getCanonicalPath()区别
- java中File类的getPath(),getAbsolutePath(),getCanonicalPath()区别
- java中file类的三种获取路径的方法getPath(),getAbsolutePath(),getCanonicalPath()的比较
- java.io.File 的 getPath getAbsolutePath 和 getCanonicalPath 的不同
- java File 的getPath getAbsolutePath和getCanonicalPath的不同
- JAVA 之 file 的 getPath、getAbsolutePath和getCanonicalPath的不同
- file中getPath()和getAbsolutePath()和getCanonicalPath()方法的区别
- file类中getPath()、getAbsolutePath()、getCanonicalPath()的区别
- File的getPath(),getAbsolutePath(),getCanonicalPath()区别
- File类的getPath()、getAbsolutePath()、getCanonicalPath()
- java.io.File 中 getPath(), getAbsolutePath() 和 getCanonicalPath() 三个方法的区别
- java.io.File 中 getPath(), getAbsolutePath() 和 getCanonicalPath() 三个方法的区别
- java 虚拟机内存布局
- 工作重点分配
- leetcode:278. First Bad Version
- Spring学习之Bean的生命周期
- 判断软键盘显示还是隐藏
- java中file的getPath(),getAbsolutePath(),getCanonicalPath()的比较
- Java---方法引用(JDK1.8)
- 光影切割问题
- iPhone固件包信息
- 招骋地址弹出按钮
- poj 2165 Gunman
- 验证身份证是否满18岁
- HTTP知识点——(一)
- Android Studio编译错误:Suggestion: use tools:overrideLibrary="xxx.xxx.xxx" to force usage