摘要: public class ListDemo { public static void main(String[] args) { //创建List集合对象 List<Student> list = new ArrayList<Student>(); //创建学生对象 Student s1 = new 阅读全文
posted @ 2020-04-08 10:26 硬盘红了 阅读(607) 评论(0) 推荐(0) 编辑
摘要: public class ListDemo { public static void main(String[] args) { //示例1: int[] arr = {1,2,3,4,5}; for (int i : arr){ System.out.println(i); } System.ou 阅读全文
posted @ 2020-04-08 09:51 硬盘红了 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 案例需求: 一个集合,里面有三个元素:list.add("hello"); list.add("world"); list.add("java"); 遍历集合,如果有”world“这个元素,我们就添加一个”javaee“元素进去。 代码如下: public class list_03 { publi 阅读全文
posted @ 2020-04-07 22:25 硬盘红了 阅读(399) 评论(0) 推荐(0) 编辑
摘要: public class ListDemo { public static void main(String[] args) { //创建List集合对象 List<Student> list = new ArrayList<Student>(); //创建学生对象 Student s1 = new 阅读全文
posted @ 2020-04-07 21:18 硬盘红了 阅读(611) 评论(0) 推荐(0) 编辑
摘要: 集合元素框架 public class ListDemo02 { public static void main(String[] args) { //创建集合对象 List<String> list = new ArrayList<String>(); //添加元素 list.add("hello 阅读全文
posted @ 2020-04-07 21:07 硬盘红了 阅读(219) 评论(0) 推荐(0) 编辑
摘要: public class CollectionDemo { public static void main(String[] args) { //创建collection集合对象 Collection<Student> c = new ArrayList<Student>(); //创建学生对象 S 阅读全文
posted @ 2020-04-06 19:28 硬盘红了 阅读(281) 评论(0) 推荐(0) 编辑
摘要: Iterator : 迭代器,集合的专用遍历方式Iterator <E> iterator() : 返回此集合中元素的迭代器,通过集合的iterator()方法得到迭代器是通过集合的iterator()方法得到的,所以我们说它是依赖于集合而存在的Iterator中的常用方法 E next() : 返 阅读全文
posted @ 2020-04-06 17:06 硬盘红了 阅读(130) 评论(0) 推荐(0) 编辑
摘要: boolean add(E e) import java.util.ArrayList; import java.util.Collection; public class CollectionDemo_02 { public static void main(String[] args) { // 阅读全文
posted @ 2020-04-06 15:40 硬盘红了 阅读(176) 评论(0) 推荐(0) 编辑
摘要: /* 自定义异常:ScoreException */ public class ScoreException extends Exception { //无参构造 public ScoreException(){} //带参构造 public ScoreException(String messag 阅读全文
posted @ 2020-04-06 14:23 硬盘红了 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 文章转载自各大神博客,用于自己学习的记录。 1. ls指令 ls为LIST的英文缩写格式。顾名思义 常用参数搭配: ls -a 列出目录所有文件,包含以.开始的隐藏文件 ls -A 列出除.及..的其它文件 2.cd指令 (changeDirectory),命令语法:cd [目录名]。 说明:切换至 阅读全文
posted @ 2019-03-27 17:56 硬盘红了 阅读(174) 评论(0) 推荐(0) 编辑