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

微信小程序做网站域名查询入口

微信小程序做网站,域名查询入口,建设公司网站方案,网站做推广需要到工信部备案吗day17_io02 1.上课代码敲一遍 2.读取一个文件,这个文件中有随机的一些数字字符,统计这些数字有几个偶数,几个奇数,并且追加写入到该文件末尾。 例如: a.txt文件: 3241256364789629090126581212515 奇数&…

day17_io02

1.上课代码敲一遍

2.读取一个文件,这个文件中有随机的一些数字字符,统计这些数字有几个偶数,几个奇数,并且追加写入到该文件末尾。

例如:
a.txt文件:
3241256364789629090126581212515
奇数:xx个
偶数:xx个

package com.cskaoyan._17day;import java.io.*;
import java.util.ArrayList;public class Exercise {public static void main(String[] args) throws IOException {try {BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream(new File("a.txt"))));String lineTxt="3241256364789629090126581212515";int a = 0;ArrayList<String> oddnumber=new ArrayList<>();ArrayList<Object> evennumber=new ArrayList<>();while ((lineTxt=br.readLine())!=null){a++;if (a % 2 == 0) {oddnumber.add(lineTxt);} else {evennumber.add(lineTxt);}}br.close();}catch (Exception e){System.out.println("read error: " + e);}}
}

3.在一个磁盘的文件里保存26个英文小写字母(乱序),将他们读入内存中,进行排序,把排好顺序的数再重新追加写到磁盘的该文件中。

package com.cskaoyan._17day;
import java.io.*;
public  class Exercise02 {public static void main(String[] args) throws IOException {FileInputStream sc = new FileInputStream("a.txt");Reader reader = new InputStreamReader( sc );FileOutputStream s = new FileOutputStream("a.txt", true);Writer writer=new OutputStreamWriter( s );char[] chars = new char[1024];int len;while((len = reader.read(chars)) != -1){bubbleSort(chars,len);writer.write("\n");writer.write(chars,0,len);}reader.close();writer.close();}private static void bubbleSort(char arr[] , int len) {for (int i=0; i < len -1; i++) {for (int j=0; j < len -1; j++) {if (arr[j] > arr[j + 1]){char temp = arr[j];arr[j] = arr[j + 1];arr[j + 1] = temp;}}}}
}

4.递归查找指定目录中(包括子目录中),所有的.java文件,并且,把所有这些找到的java文件,复制(是复制不是移动)到一个指定的目录下

package com.cskaoyan._17day;import java.io.*;
import java.util.ArrayList;public class Exercise03 {public static void main(String[] args) {File sc = new File("D:\\");File file = new File("D:\\ ");file.mkdir();String targetDir = "";eachFile(sc);//复制所有。java文件到目标文件夹for (int i=0; i < file.length(); i++) {FileInputStream input = null;FileOutputStream output = null;try{input = new FileInputStream(file.get(i));InputStream inbuffer = new BufferedInputStream(input);//目标文件由输出流自己创建output = new FileInputStream(targetDir + file.get(i).getName());OutputStream outbuffer=new BufferedOutputStream(output);//利用字节缓冲流复制文件byte[] b = new byte[1024];int len;while ((len = inbuffer.read(b)) != -1){outbuffer.write(b,0,len);}} catch (IOException e) {e.printStackTrace();}finally {closeQuietly(input);closeQuietly(output);}}}public static void closeQuietly(Closeable closeable){try{if (closeable != null){closeable.close();}} catch (IOException e){e.printStackTrace();}}public static ArrayList<File> files = new ArrayList<>();//遍历这个文件夹内的所有子目录和文件public static void eachFile(File file){try{File[] targetFile = file.listFiles();for (int i=0; i < targetFile.length; i++) {if (targetFile[i].isDirectory()){eachFile(targetFile[i]);}else{//找到所有的java文件并且放到集合中if (targetFile[i].getName().endsWith("java")){file.add(targetFile[i]);}}}} catch (Exception e){e.printStackTrace();}}
}

5.开始写阶段6(慢慢写不急着交,周末也可以写)

http://www.mnyf.cn/news/47998.html

相关文章:

  • 页面设计排版网站微信朋友圈营销文案
  • 国家企业信息管理系统新手seo要学多久
  • b站 网站建设上海企业网站推广
  • 做公司展示网站站内推广方式有哪些
  • 怎么做游戏测评视频网站关键词优化公司费用多少
  • 电商网站里的水果图片怎么做的seo技术快速网站排名
  • 网站建设空间一般多大知名网络营销推广
  • 河北住房与城乡建设部网站企业网站注册域名的步骤
  • 实搜石家庄网站建设小程序推广网站多少钱
  • 上海网站建设-网建知识html网页制作代码大全
  • 做音乐头像网站什么是百度搜索推广
  • 移动应用网站开发宁波seo自然优化技术
  • 网站首页的名字通常是网络软文是什么意思
  • 拍宣传片找什么公司宁波品牌网站推广优化
  • wordpress 网站静态百度一下 你就知道首页官网
  • 网站建设90g 吾爱破解抖音seo系统
  • 头像制作网站大连网络营销seo
  • 营销型网站制作步骤五个seo软件哪个好
  • 广东省建设工程网站北大青鸟职业技术学院简介
  • 网络培训的网站建设怎么去推广自己的公司
  • wordpress关闭百度seo网站
  • 电子政务建设与政府网站建设南阳本地网络推广优化公司
  • 3d动画制作软件免费网站seo主要是做什么的
  • 遵义企业做网站滕州网站建设优化
  • 深圳快速网站制网络营销内容
  • 注册完域名怎么做网站seo网站结构优化
  • wordpress 美丽说关键词营销优化
  • 大型网站建设网站推广2018十大网络营销案例
  • 网站建设怎么样做账拉新推广渠道
  • 网站前端切页面时间网站搜索引擎优化技术