12.6 Basic UML Diagrams

Introduction to UML Diagrams

You might be thinking at this point that it’s a lot of work to tell another programmer how to build a class because there’s so much information you need to convey. Luckily, there’s something called UML (Unified Modeling Language) Diagrams that were created just for this purpose.

There’s a lot of different symbols and notation for UML Diagrams, so let’s just learn the basics. Here’s what a UML Diagram for the Person class from before looks like:

UML Diagram for the Person class


- name: String
- age: int
- address: String
- hungry: boolean
+ Person()
+ Person(name: String, age: int, address: String, hungry: boolean)
+ talk(Message: String): void
+ eat(food: String): void
+ walk(): void
+ getName(): String
+ setName(Name: String): void
+ getAge(): int
+ setAge(Age: int): void
+ getAddress(): String
+ setAddress(Address: String): void
+ isHungry: boolean
+ setHungry(Hungry: boolean): void



Create the Circle class given a UML diagram.


Create a UML diagram for the Account class.

Previous Section

Next Section


Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.