I would like to know if it is allowed in the UML to specify a different return type for overloaded operations. This is possible for methods in Java:

public class C
    public int addOne(int a) {
        return a + 1;

    public float addOne(float f) {
        return f + 1f;

My question is whether this is also allowed in the official UML specification:

Example UML class diagram

1 Answer 1


There's nothing in the UML specification (UML 2.5.1) that forbids it. So yes, you can.

  • Thank you. These things are hard to research as it is difficult to find the right passages in the near 800-page documentation and exclude the possibility of missing something.
    – xoric
    May 8, 2019 at 13:06
  • @xoric It isn't easy to tell that something isn't there. Looking at section 9.6, there doesn't seem to be anything to prohibit overloads. Given how many object oriented languages support overloads, I don't think UML would ever prohibit them anyway.
    – Simon B
    May 8, 2019 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.