工作总结 CTO(张王岩) File构造器

时间:2019-11-15 20:18:11   收藏:0   阅读:45
 1 import java.io.File;
 2 
 3 /**
 4  * 构建File对象
 5  * @author Allen17805272076
 6  *
 7  */
 8 public class FileDemo2 {
 9     public static void main(String[] args) {
10         String path="C:/web/workspace/IO-study/src/userImg.GIF";
11         //1、构建File对象
12         File src = new File(path);
13         System.out.println(src.length());
14         
15         //2、构建File对象
16         src=new File("C:/web/workspace/IO-study/src/","userImg.GIF");
17         System.out.println(src.length());
18         
19         //3、构建File对象
20         
21         src=new File(new File("C:/web/workspace/IO-study/src/"),"userImg.GIF");
22     }
23     
24 
25 }

技术图片

 

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!