当前位置: 代码迷 >> 综合 >> 【Java】引用类型数组
  详细解决方案

【Java】引用类型数组

热度:66   发布时间:2024-03-08 05:47:25.0

Java 引用类型数组

String[] arrs = {"hello", "Java"}; 静态创建数组 

Student stu = {new Student("张三", 19), new Student("张三", 19) }; 静态创建对象数组

String[] arrs2 = new String[5]; 动态创建数组,默认数组值为null

Student[] stu2 = new Student[2];

stu2[0] = new Student("张三", 19);

arrs.length 数组长度

Alt + Shift + S 自动创建封装set/get/构造函数