getAbsolutePath getCanonicalPath 区别以及 当前目录、上级目录 用法
来源:互联网 发布:文件下载 java 编辑:程序博客网 时间:2024/05/28 17:05
File file = new File("./.project");System.out.println(file.getAbsolutePath());System.out.println(file.getCanonicalPath());if(file.exists()){String line = new Reader(file.getAbsolutePath()).readAll();System.out.println(line);}file = new File("../test.txt");System.out.println(file.getAbsolutePath());System.out.println(file.getCanonicalPath());if(file.exists()){String line = new Reader(file.getAbsolutePath()).readAll();System.out.println(line);}
在eclipse 中新建一个工程。跑完上一个程序就知道咋回事了
运行结果
E:\workspaces\MyEclipse_9\openfire\.\.projectE:\workspaces\MyEclipse_9\openfire\.project<?xml version="1.0" encoding="UTF-8"?><projectDescription>。。。。</natures></projectDescription>E:\workspaces\MyEclipse_9\openfire\..\test.txtE:\workspaces\MyEclipse_9\test.txtdfdfdfE:\workspaces\MyEclipse_9\openfire
- getAbsolutePath getCanonicalPath 区别以及 当前目录、上级目录 用法
- getPath(),getAbsolutePath(),getCanonicalPath()区别
- Java getPath() getAbsolutePath() getCanonicalPath()区别
- file.getPath() getAbsolutePath() getCanonicalPath()区别
- file.getPath() getAbsolutePath() getCanonicalPath()区别
- file.getPath() getAbsolutePath() getCanonicalPath()区别
- 获取当前目录的上级目录
- python 获取当前目录和上级目录
- mkdir()与 mkdirs()方法的区别 ;目录和文件的区别;绝对路径和相对路径的详解;file的getPath getAbsolutePath和getCanonicalPath的不同
- getPath getAbsolutePath和getCanonicalPath的区别
- getPath getAbsolutePath和getCanonicalPath的区别
- getPath getAbsolutePath和getCanonicalPath的区别
- java里getPath、 getAbsolutePath、getCanonicalPath的区别
- java里getPath、 getAbsolutePath、getCanonicalPath的区别
- File的getPath(),getAbsolutePath(),getCanonicalPath()区别
- getPath getAbsolutePath和getCanonicalPath的区别
- getPath(), getAbsolutePath()和 getCanonicalPath() 的区别
- getPath getAbsolutePath和getCanonicalPath的区别
- 数据库桌面
- Java中如何由枚举常量的ordinal值获得枚举常量对象
- Android如何防止apk程序被反编译
- android 图片处理代码收集
- Android中Activity之间传递自定义对象
- getAbsolutePath getCanonicalPath 区别以及 当前目录、上级目录 用法
- C#中的除法和四舍五入运算
- linuxLog服务器
- 详解SQL Server Profiler分析死锁几大步骤
- 模板特化和强制转换的问题
- 关于数据库操作整理的一些经验
- Hibernate自定义数据类型UserType
- 关于Windows中的hook(钩子)【转自网络】
- hdu 2102 A计划