上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 23 下一页
摘要: 快捷键ALT+Insert 也可以在代码里右键,选Generate 选Constructor是生成构造方法 直接点【Select None】是生成无参构造 按住shift点【address:String】,也就是把所有成员变量选中,然后点ok,就生成4个参数的构造方法,想选中其中几个,就按住ctrl 阅读全文
posted @ 2022-01-19 07:54 大灰狼21 阅读(1591) 评论(0) 推荐(0)
摘要: mport java.util.ArrayList;import java.util.Scanner;public class ArrayListTest { public static void main(String[] args) { ArrayList<Student> array = ne 阅读全文
posted @ 2022-01-18 16:43 大灰狼21 阅读(54) 评论(0) 推荐(0)
摘要: mport java.util.ArrayList;public class ArrayListTest02 { public static void main(String[] args) { ArrayList<Student> array = new ArrayList<>(); Studen 阅读全文
posted @ 2022-01-18 09:59 大灰狼21 阅读(66) 评论(0) 推荐(0)
摘要: import java.util.ArrayList;public class ArrayListsTest01 { public static void main(String[] args) { ArrayList<String> array = new ArrayList<>(); array 阅读全文
posted @ 2022-01-18 09:50 大灰狼21 阅读(43) 评论(0) 推荐(0)
摘要: 1. 2. 3. 4. 5. 几个索引越界错误:IndexOutOfBoundsException 1. 2. 3. 阅读全文
posted @ 2022-01-18 09:38 大灰狼21 阅读(17) 评论(0) 推荐(0)
摘要: 构造方法 ArrayList<String> array=new ArrayList<>(); 这个写法是JDK7之后的新特性,以前写法: ArrayList<String> array=new ArrayList<String>(); 原索引0,1,2,使用add方法时写3不会索引越界,而是在末尾 阅读全文
posted @ 2022-01-18 09:08 大灰狼21 阅读(238) 评论(0) 推荐(0)
摘要: java.util包下,所以得导包 ArrayList<E>: 底层是可调大小的数组 <E>是一种特殊的数据类型,泛型 例如: ArrayList<String> ArrayList<Student> 阅读全文
posted @ 2022-01-18 08:50 大灰狼21 阅读(31) 评论(0) 推荐(0)
摘要: 引入原因: 数组长度固定,需求是不确定数据的长度,所以引入集合。 集合特点: 存储空间可变,存储数据容量可以发生改变 阅读全文
posted @ 2022-01-18 08:46 大灰狼21 阅读(16) 评论(0) 推荐(0)
摘要: public class StringBuilderDemo02 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("请输入一个字符串:"); Stri 阅读全文
posted @ 2022-01-17 19:56 大灰狼21 阅读(115) 评论(0) 推荐(0)
摘要: StringBuilder转换为String public String toString() StringBuilder sb = new StringBuilder();sb.append("hello");String s = sb.toString();System.out.println( 阅读全文
posted @ 2022-01-17 19:46 大灰狼21 阅读(272) 评论(0) 推荐(0)
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 23 下一页