摘要: 集合的每个内部类里面都有一个独有的迭代器,ArrayList\LinkedList\HashSet 里面都继承了Collection的迭代器 Collection c=new ArrayList() //继承 Iterator it=c.iterator() //返回当前集合的迭代器对象 while 阅读全文
posted @ 2020-07-29 12:01 xinZhiZhu 阅读(93) 评论(0) 推荐(0) 编辑
摘要: String: 下面三条语句分别创建了几个对象: String s1=new String("abc");// 2 堆中一个,方法区一个 String s2="abc";// 0 String s3=new String("abc");// 1 堆中一个 String s4="he"+"ll"+"o 阅读全文
posted @ 2020-06-27 19:18 xinZhiZhu 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 选择排序: int []arry={85,64,3,5,1,94,2,31,0,60}; for(int i=0;i<arry.length-1;i++){ int min=i; //min最为标记记录当前最小值,把最小的值放在前面 for(int j=i+1;j<arry.length;j++){ 阅读全文
posted @ 2020-06-24 18:05 xinZhiZhu 阅读(147) 评论(0) 推荐(0) 编辑
摘要: catch必须从小类型异常的到大类型异常进行捕捉 catch(FileNotFoundException e){ e.printStackTrace();//输出异常信息 } finally为了保证某一资源一定会释放,所以finally语句中写释放资源的代码: public static void 阅读全文
posted @ 2020-06-24 18:00 xinZhiZhu 阅读(130) 评论(0) 推荐(0) 编辑
摘要: //创建数组 final int N = 10; int[][] yang=new int[N][]; for(int i=0;i<yang.length;i++){ yang[i]=new int[i+1]; } //赋值 for(int i=0;i<yang.length;i++){ for(i 阅读全文
posted @ 2020-06-24 11:42 xinZhiZhu 阅读(517) 评论(0) 推荐(0) 编辑
摘要: 数据类型:之类型转换: char a='a';//a这个字符在ASCII编码上位于97位 char b='中'; int i=a;//自动类型转换 char d=48; System.out.println(i);//97 System.out.println(d);//0 这个0不是整形0 而是一 阅读全文
posted @ 2020-06-17 18:39 xinZhiZhu 阅读(158) 评论(0) 推荐(0) 编辑
摘要: def function_name(): 函数体 函数调用() 不定长参数: 1:单个元素 def add(*args): sum=0 for i in args: sum+=i print(sum) add(2,4,2,9) 2:类似于字典中键值对的不定长形式 def print_info(*ar 阅读全文
posted @ 2020-06-08 19:29 xinZhiZhu 阅读(141) 评论(0) 推荐(0) 编辑
摘要: buntu: 常用到的apt命令: apt-cache search package 搜索包apt-cache show package sudo apt-get install package 安装包 sudo apt-get remove package 删除包 sudo apt-get rem 阅读全文
posted @ 2020-06-06 10:15 xinZhiZhu 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 文件操作: 在同级目录下,访问文件text1 file=open('text1','r')#若同级目录下没有text1文件时,python会新创建text1文件 print(file.read()) file.close() 对于文件的操作,实质上就三部:打开>操作>关闭(虽然python自己会关闭 阅读全文
posted @ 2020-06-05 12:10 xinZhiZhu 阅读(114) 评论(0) 推荐(0) 编辑
摘要: time: 获取时间:获取格式化时间: import time local=time.asctime(time.localtime(time.time()))print("the localtime is",local) 格式化日期: import time time.strftime("%Y-%m 阅读全文
posted @ 2020-06-01 18:48 xinZhiZhu 阅读(336) 评论(0) 推荐(0) 编辑