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

做信息类网站怎么赚钱如何让百度搜索排名靠前

做信息类网站怎么赚钱,如何让百度搜索排名靠前,微信免费建站,plm项目管理系统文件的创建 方式1: new File(String pathName) 根据路径构建一个File对象方式2: new File(File parent,String child) 根据父目录文件子路径构建方式3: new File(String parent,String child) 根据父目录子路径构建 代码: //方…

文件的创建

  1. 方式1: new File(String pathName) 根据路径构建一个File对象
  2. 方式2: new File(File parent,String child) 根据父目录文件+子路径构建
  3. 方式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();}}

常用方法

  1. getName():获取文件名字。
  2. getAbsolutePath():获取文件的绝对路径。
  3. getParent():获取文件的父级目录。
  4. length():获取文件的大小(以字节为单位)。
  5. exists():判断文件是否存在。
  6. isFile():判断是否为一个文件。
  7. isDirectory():判断是否为一个目录。
  8. delete():删除文件
  9. mkdirs():创建多级目录
  10. 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/562157/

相关文章:

  • dw做的网站怎么让别人看到如何建立一个网站
  • 保险网站建设优缺点seo代码优化步骤
  • 如何快速建网站百度电脑版入口
  • 山东省建设工程信息网站最近最新的新闻
  • 免费网站建设方案锦绣大地seo官网
  • 电子商务的网站建设牛排seo系统
  • 资源收费网站怎么做网站快速优化排名官网
  • 招标网哪个网站信息可靠百度站长工具网站
  • 郑州七七网站建设互联网推广公司
  • 佛山做外贸网站代理商百度收录技术
  • 公司网站建设需要什么今日热搜第一名
  • 烟台建设企业网站网站快速收录入口
  • 怎么做繁体字网站网络营销公司注册找哪家
  • 做ppt介绍网站吗网站搜索引擎优化工具
  • 深圳网站建设有没有市场百度搜索推广的五大优势
  • 网站建设好的图片百度互联网营销
  • 柳州网站制作公司seo优化什么意思
  • 网站建设做的好的公司淘宝关键词优化怎么弄
  • 手机网站用模版方象科技的企业愿景
  • 沈阳网站建设技术公司排名公司市场营销策划方案
  • 赣州网站建设怎样石家庄最新消息
  • 公司注册地址和经营地址不一致可以吗长春seo招聘
  • 好的做问卷调查的网站好推广有奖励的app平台
  • 有专业设计网站吗百度指数与百度搜索量
  • 网站的整体结构百度云网盘资源搜索引擎入口
  • 咸阳网站建设哪家专业杭州优化公司在线留言
  • 地板网站建设门户网站
  • 新增备案网站负责人人工智能培训心得体会
  • 帮境外赌场做网站是否有风险百度企业号
  • 网站换了服务器百度seo排名优化公司哪家好