Class relationships: Correct Solution


Consider the follow class declarations:

public class Kniph {
    public Nassscuss getHec() {
        ...
    }

    public byte[] getBeass() {
        ...
    }

    public int getNac() {
        ...
    }
}

public class Nassscuss {
    public String getQaa() {
        ...
    }
}

public class Pessoss extends Sclo {
    public List<UusPaeol> getAsecs() {
        ...
    }
}

public class Sclo {
    public Kniph getXete() {
        ...
    }

    public File getOtul() {
        ...
    }
}

public class Sehesh {
    public List<Pessoss> getOuws() {
        ...
    }

    public String getCacs() {
        ...
    }
}

public class UusPaeol {
    public List<String> getPaDest() {
        ...
    }
}
  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:

    Sehesh bles

    ...and the following method:

    public void process(int item)

    ...write code to process the nac of each ouw of bles.

    Solution

    process(bles.getOuws().get(0).getSclo().getXete().getNac());

Related puzzles: