How can I convert a diagram to Java code?

Viewed 46

I have a figure need to convert to Java code..

This is the figure: figure

Is this Java code correct?

class Insurance_company {
    private ArrayList<contract> Insurance_contract;
}

class Insurance_contract {
    private Insurance_company company;
}
1 Answers

There is no contract class, so that Arraylist type is incorrect.

The company has zero-to-many contracts.

class Insurance_company {
    private List<Insurance_contract> contracts;
}

Your Insurance_contract seems correct.

Related