- 博客(3)
- 收藏
- 关注
原创 构造器
/** 构造器:1.和类名相同 2.没有返回值 作用:1.new的本质是调用构造方法 2.初始化对象的值 注意:创建有参构造后,如果想调用无参构造,必须显式定义一个无参构造 */ public class Application1 { public static void main(String[] args) { Person roommates = new Person("小王",18,178 ); System.out.println(r
2021-03-27 17:40:05
76
原创 增强for循环在一维数组和二维数组中的运用
增强for循环在一维数组和二维数组中的运用 public class forPlus { public static void main(String[] args) { //一维数组中的应用 int[] array = {2, 5, 8, 9, 7}; for (int i : array) { System.out.print(i+"\t"); } System.out.println("
2021-03-27 00:36:49
356
原创 稀疏数组的创建与还原
稀疏数组的创建和还原 ================================================== public class Sparsearray { //创建一个二维数组 public static void main(String[] args) { int[][]array1=new int[11][11]; array1[2][3]=2; array1[3][4]=5; System.out.
2021-03-26 23:29:44
105
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人