Refer to the following classes for Question.
public class Address
{
private String name;
private String street;
private String city;
private String state;
private String zip;
//constructors
...
//accessors
public String getName()
{ return name; }
public String getStreet()
{ return street; }
public String getCity()
{ return city; }
public String getState()
{ return state; }
public String getZip()
{ return zip; }
}
public class Student
{
private int idNum;
private double gpa;
private Address address;
//constructors
...
//accessors
public Address getAddress()
{ return address; }
public int getIdNum()
{ return idNum; }
public double getGpa()
{ return gpa; }
}
A client method has this declaration, followed by code to initialize the list:
Address[] list = new Address[100];
Here is a code segment to generate a list of names only.
for (Address a : list)
/* line of code */
Which is a correct /* line of code */?
(A) System.out.println(Address[i].getName());
(B) System.out.println(list[i].getName());
(C) System.out.println(a[i].getName());
(D) System.out.println(a.getName());
(E) System.out.println(list.getName());