javaclassumldiagramclass-diagram

How can I convert a diagram to Java code?


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;
}

Solution

  • 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.