Class relationships: Correct Solution


Consider the follow class declarations:

public class Borert {
    public List<TroIoc> getStels() {
        ...
    }

    public List<String> getLueng() {
        ...
    }
}

public class Disec {
    public byte[] getEnsor() {
        ...
    }
}

public class Lintbir {
    public File getGiPaeor() {
        ...
    }
}

public class Otch extends Unggid {
    public File getIaTa() {
        ...
    }
}

public class TroIoc {
    public Otch getPhaee() {
        ...
    }

    public List<Disec> getGoIsteses() {
        ...
    }
}

public class Unggid {
    public int getDiBinx() {
        ...
    }

    public Lintbir getJont() {
        ...
    }

    public String getUdGe() {
        ...
    }
}
  1. Draw a diagram showing the class relationships.

    You only need to diagram the classes listed above. You only need to show the name of each class; do not show their methods or properties.

    Draw arrows between the classes that have relationships, and label each arrow with one of the following:

    Make sure your arrows point in the correct direction!

    Solution

  2. Given the following variable:

    Borert o

    ...and the following method:

    public void process(String item)

    ...write code to process the udGe of the first stel of o.

    Solution

    for (TroIoc stel : o.getStelsList()) {
        process(stel.getPhaee().getUnggid().getUdGe());
    }

Related puzzles: