当前位置: 首页 > news >正文

网站建设vip教程网页设计html成品免费

网站建设vip教程,网页设计html成品免费,建一个网站需要哪些知识,网站设计哪家公司好文件的创建 方式1#xff1a; new File(String pathName) 根据路径构建一个File对象方式2#xff1a; new File(File parent,String child) 根据父目录文件子路径构建方式3#xff1a; new File(String parent,String child) 根据父目录子路径构建 代码#xff1a; //方…文件的创建 方式1 new File(String pathName) 根据路径构建一个File对象方式2 new File(File parent,String child) 根据父目录文件子路径构建方式3 new File(String parent,String child) 根据父目录子路径构建 代码 //方式1 new File(String pathName) 根据路径构建一个File对象public void creat1() {String pathName d:\\creatFile\\file1.txt;File file1 new File(pathName);try {file1.createNewFile();System.out.println(文件1创建成功);} catch (IOException e) {e.printStackTrace();}}//方式2 new File(File parent,String child) 根据父目录文件子路径构建public void creat2(){File parent new File(d:\\);String child file2.txt;File file2 new File(parent, child);try {file2.createNewFile();System.out.println(文件2创建成功);} catch (IOException e) {e.printStackTrace();}}//方式3 new File(String parent,String child) 根据父目录子路径构建public void creat3(){String parent d:\\;String child file3.txt;File file2 new File(parent, child);try {file2.createNewFile();System.out.println(文件3创建成功);} catch (IOException e) {e.printStackTrace();}}常用方法 getName()获取文件名字。getAbsolutePath()获取文件的绝对路径。getParent()获取文件的父级目录。length()获取文件的大小以字节为单位。exists()判断文件是否存在。isFile()判断是否为一个文件。isDirectory()判断是否为一个目录。delete()删除文件mkdirs()创建多级目录mkdir()创建父目录(一级目录) 代码 public void fileMethods(){//先创建文件对象File file new File(d:\\file1.txt);//调用相应的方法得到对应信息System.out.println(文件名字 file.getName());//getName、getAbsolutePath、getParent、length、exists、isFile、isDirectorySystem.out.println(文件绝对路径 file.getAbsolutePath());System.out.println(文件父级目录 file.getParent());System.out.println(文件大小(字节) file.length());System.out.println(文件是否存在 file.exists());//TSystem.out.println(是不是一个文件 file.isFile());//TSystem.out.println(是不是一个目录 file.isDirectory());//F}public void delete(){File file1 new File(d:\\file3.txt);if(!file1.exists()){System.out.println(文件不存在);}else {if(file1.delete()){System.out.println(文件删除成功);}else {System.out.println(文件删除失败);}}}public void delete2(){File file1 new File(d:\\file1);if(!file1.exists()){System.out.println(文件不存在);}else {if(file1.delete()){System.out.println(文件删除成功);}else {System.out.println(文件删除失败);}}}public void creat(){String directoryPath d:\\file1\\ret;File file new File(directoryPath);if(file.exists()){System.out.println(文件存在);}else {if(file.mkdirs()){//mkdirs()创建多级目录,如:d:\\file1\\ret。mkdir()创建父一级目录,如d:\\file2System.out.println(文件创建成功);}else {System.out.println(文件创建失败);}}}
http://www.hkea.cn/news/14282485/

相关文章:

  • 请谁做网站比较放心wordpress搭建好后如何在前台显示
  • 旅游网站开发设计报告书jetty网站开发
  • 科技公司网站设计服务蓝天下摄影作品排列网页模板
  • 校园网站的建设wix网站制作
  • 龙元建设集团有限公司网站做家政网站公司
  • 设计师网站兼职免费开源网站系统
  • 博客论坛网站开发公司让做网站违法
  • 为企业做网站建设优化小程序包年竞价凡科网用户登录
  • 营销型网站的建设软文使馆网站建设
  • 建设一个怎样的自己的网站建设一个打鱼游戏网站
  • 怎样做企业手机网站建设网页设计与制作配套素材
  • 滁州市大滁城建设网站wordpress数据搬移
  • 德化县住房和城乡建设局网站东道设计地址
  • 明年做那个网站能致富中国建设协会官网证件查询
  • 网站广告投放价格表广西建设厅考试网站首页
  • 网站排名必做阶段性seo策略获取更多付费流量
  • 湖南土特产销售网网站建设制作dede投票类网站源码
  • 如何在外管局网站做延期收汇鲁班设计远程工作
  • 贸易公司寮步网站建设哪家好信息流广告案例
  • 海外社交网站开发推广普通话的文章
  • 外贸如何建立网站企业网站的页面信息该如何排放
  • 义乌婚介网站建设杭州电商网站建设公司
  • 关于国家对网站建设临沂网站制作计划
  • 广州网站建设快速排名公众号怎么弄好看的模板
  • 企业网站设计seo中国电信网站备案流程
  • 贵州网站开发百度推广竞价排名
  • 福州网站建设模板网站建设目标有哪几个方面
  • 平邑网站建设龙岩seo外包公司
  • vs做的网站排版错位国外的跨境电商平台有哪些
  • 打开网站很慢wordpress m1 cms