In Java Array we have discussed about the arrays of primitive data types. We can also create array of objects references and initialize data for each reference (or element) of the array. Objects references are explained in Java Objects References
class Student Student , we can create an array of the references of the Student as shown below. Here we have a created an array of size 2 and with name students .
Student[] students = new Student[2]; LINE A and LINE B .
students[0] = new Student(); // LINE A . ) as usual.
students[0].name = "David";
|