Class relationships: Correct Solution


Consider the follow class declarations:

public class Cret extends Sakid {
    public Elsop getTosim() {
        ...
    }
}

public class Elsop {
    public String getUsCisa() {
        ...
    }
}

public class Ierpri {
    public byte[] getGluvi() {
        ...
    }

    public File getCeci() {
        ...
    }
}

public class Legrem {
    public int getPifer() {
        ...
    }
}

public class Moossfe {
    public File getPsan() {
        ...
    }

    public Ierpri getCeplu() {
        ...
    }
}

public class Sakid {
    public List<Legrem> getJarpas() {
        ...
    }

    public List<Moossfe> getOnhaus() {
        ...
    }
}
  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:

    Cret ri

    ...and the following method:

    public void process(File item)

    ...write code to process the ceci of each onhau of ri.

    Solution

    process(ri.getSakid().getOnhaus().get(0).getCeplu().getCeci());

Related puzzles: