您的位置:首页 > 其它

[IO]——File对象

2016-04-04 02:23 344 查看
public class demo02 {
public static void main(String[] args) {
String parentPath="E:/others";
String name="w.png";
//以相对路径构建
File src=new File(parentPath, name);//以相对路径构建
src=new File(new File(parentPath), name);
System.out.println(src.getName());
System.out.println(src.getPath());
//绝对路径
src=new File("E:/others/w.png");
//没有指定盘符:以user.dir构建
src=new File("test.txt");
src=new File(".");//以当前路径
System.out.println(src.getAbsolutePath());
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  IO