package edu.tjcu.wfh1.Demo04;publicclassDemo01Array{publicstaticvoidmain(String[] args){//重建一个长度为三的数组,用来存储person类型的对象
Person array[]=newPerson[3];
System.out.println(array[0]);//null
Person one =newPerson("迪丽热巴",18);
Person two =newPerson("古力娜扎",19);
Person three =newPerson("马尔扎哈",58);// 将one中的地址值赋给数组的0号位置元素
array[0]= one;
array[1]= two;
array[2]= three;
System.out.println(array[0]);//地址值 edu.tjcu.wfh1.Demo04.Person@2d98a335
System.out.println(array[1]);//地址值 edu.tjcu.wfh1.Demo04.Person@16b98e56
System.out.println(array[2]);//地址值 edu.tjcu.wfh1.Demo04.Person@7ef20235
System.out.println(array[0].getName());// 迪丽热巴}}
package edu.tjcu.wfh1.Demo04;public class Demo01Array { public static void main(String[] args) { //重建一个长度为三的数组,用来存储person类型的对象 Person array[] = new Person[3]; System.out.println(array[0]); //null Person one = new Pe