How place an object in a class?

Hi.
I’m doing a Java project, and I have one class which have some methods and no one attribute, but two objects from another classes.
How can I represent it?

For exemple:

Control


???


  • save(String): void
    +change(String): void

Hi Rafael Ap.,

Thanks for your post. Could you please clarify that “two objects from another classes” means property of other classes, or the other classes as the type of operation parameter, or as return type? Thanks!

Best regards,
Lilian Wong

In your little sketch, it seems like you want to add them as an attribute.

There are different possibilities.

You can use an association, one-way-navigable.
Use a composition, if the attributes die with the containing attributes,
an aggregation if the objects are part of containing one(some kind of “membership”) or a simple association.

On the other hand, you could just add an attribute and chosse the desired class as datatype on the specifications-window.

regards,
Christian