Олимпиадный тренинг

Задача . 37441


Задача

Темы:
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.
   foreach (Address a in list)
    /* line of code */ 
Which is a correct /* line of code */?
(A) Console.WriteLine(Address[i].getName());
(B) Console.WriteLine(list[i].getName());
(C) Console.WriteLine(a[i].getName());
(D) Console.WriteLine(a.getName());
(E) Console.WriteLine(list.getName());

time 1000 ms
memory 32 Mb
Правила оформления программ и список ошибок при автоматической проверке задач

Статистика успешных решений по компиляторам
Комментарий учителя