- 1Use Case Diagram in UML | Beginner's Guide with Java and Real-World Examples
- 2Activity Diagram in UML | Java-Centric Beginner's Guide with Real Examples
- 3Sequence Diagram in UML | Step-by-Step Java Guide with Real-World Examples
- 4UML Communication Diagram | Java-Based Tutorial with Real-Life Examples
- 5UML State Machine Diagram | Java-Centric Tutorial with Real Examples
- 6UML Interaction Overview Diagram | Java Tutorial with School-Based Examples
- 7UML Timing Diagram | Java Tutorial with Real-World Timing Examples


- 1Class Diagram in UML | Beginner-Friendly Guide with Examples
- 2Object Diagram in UML | Simple, Visual Examples for Beginners
- 3Component Diagram in UML | Beginner-Friendly Tutorial with Java Examples
- 4Deployment Diagram in UML | Beginner’s Guide with Examples and Java Use Cases
- 5Package Diagram in UML | Java-Focused Tutorial with Real Examples
- 6Composite Structure Diagram in UML | Java Examples & Complete Guide for Beginners

- 1Use Case Diagram in UML | Beginner's Guide with Java and Real-World Examples
- 2Activity Diagram in UML | Java-Centric Beginner's Guide with Real Examples
- 3Sequence Diagram in UML | Step-by-Step Java Guide with Real-World Examples
- 4UML Communication Diagram | Java-Based Tutorial with Real-Life Examples
- 5UML State Machine Diagram | Java-Centric Tutorial with Real Examples
- 6UML Interaction Overview Diagram | Java Tutorial with School-Based Examples
- 7UML Timing Diagram | Java Tutorial with Real-World Timing Examples

- 1UML Relationships in Java: Association, Aggregation, Composition Explained with Examples
- 2UML Inheritance and Generalization | Java Examples for Beginners
- 3Interfaces vs Abstract Classes in UML with Java Examples
- 4Multiplicity and Navigability in UML – Easy Guide with Real-Life Examples
- 5Constraints and Notes in UML – Beginner-Friendly Guide with Java Examples

- 1UML in Software Development Lifecycle (SDLC) – Complete Guide with Examples
- 2How to Create UML Diagrams from Requirements – Step-by-Step with Examples
- 3UML and Agile: A Practical Guide for Beginners
- 4Case Study: UML for an E-commerce Application – Step-by-Step UML Design
- 5UML Best Practices and Common Mistakes – A Beginner’s Guide with Examples


- 1Quiz: UML Concepts – Test Your Understanding of UML Diagrams and Principles
- 2Practical Assignment: UML Modeling – Step-by-Step UML Design Task for Java Beginners
- 3UML Review and Feedback – How to Evaluate and Improve UML Models in Java Projects
- 4UML Certificate of Completion – How to Earn and Use Your Certification
Activity Diagram in UML
Next Topic ⮕Sequence Diagram in UML | Step-by-Step Java Guide with Real-World Examples
Introduction
In every software application, there's a story playing out — a flow of actions, decisions, and sometimes parallel tasks. UML Activity Diagrams are designed to tell that story visually. They're perfect for modeling business workflows, logic flows, and use case processes in a way that's easy to understand, even without reading the code.
In this tutorial, you’ll learn how to use activity diagrams to represent the dynamic flow of control in a system. We’ll explore notation, real-world Java examples, and walk through detailed cases based on a familiar theme — a school management system.
What is an Activity Diagram?
An Activity Diagram is a behavioral UML diagram that represents the flow of control or object flow. It’s similar to a flowchart but more expressive — able to show concurrency, decisions, loops, and object states.

Why Use Activity Diagrams?
- Model workflows: Ideal for describing how a task is accomplished from start to finish
- Capture use case behavior: Complements use case diagrams by showing internal steps
- Define logic clearly: Useful for developers, analysts, and testers
- Bridge design and code: Helps you map flow to Java methods and logic
Key Elements of an Activity Diagram
1. Initial Node
The starting point of the activity. Shown as a filled black circle.
2. Activity (Action) Nodes
Tasks or steps to perform. Shown as rectangles with rounded corners.
3. Decision Node
A branching point. Shown as a diamond shape with outgoing arrows labeled with conditions.
4. Merge Node
Combines multiple alternative flows. Also a diamond, but with multiple incoming flows.
5. Fork & Join Nodes
Fork splits flow into parallel paths. Join synchronizes them. Represented as thick horizontal or vertical bars.
6. Final Node
Marks the end of the activity. Shown as a bullseye (black circle within a white circle).
7. Control Flows
Arrows showing the order of actions.

Example Scenario: Exam Registration Process
Step-by-Step Activities
- Student logs in
- System checks eligibility
- If eligible, student selects subjects
- Submits registration
- If not eligible, system displays message
Activity Diagram for This Flow

Java Analogy
public void registerForExam(Student student) {
if (!student.isEligible()) {
showMessage("You are not eligible");
return;
}
List<Subject> subjects = selectSubjects(student);
submitRegistration(student, subjects);
}
This method corresponds directly with the flow shown in the activity diagram — each line of logic maps to an action or decision node.
How to Create an Activity Diagram: Step-by-Step
Step 1: Define the Process
Identify what task or workflow you’re modeling — e.g., “View Marks,” “Submit Attendance,” etc.
Step 2: List Activities
Break the process into small steps or decisions — login, check eligibility, confirm registration, etc.
Step 3: Start with the Initial Node
Place the black circle to denote the start of the flow.
Step 4: Add Actions and Decisions
Use rectangles for tasks and diamonds for decisions. Label the flows for clarity.
Step 5: End with the Final Node
Place the bullseye to indicate the end of the activity.
Step 6: Add Parallelism (Optional)
If tasks can run concurrently (e.g., notify admin and send confirmation), use a fork/join structure.
More Example: Viewing Student Report
Process Flow
- Login
- Check role (student)
- Fetch report
- Display report

Use Cases for Activity Diagrams
- Business Process Modeling: Approval processes, workflows, onboarding steps
- Use Case Detailing: Drill-down into what happens inside a use case
- Algorithm Visualization: Understand flow before implementing in code
- Testing: Helps QA teams understand flow for writing test cases
Best Practices
- Use simple and clear action names: “Check Eligibility” is better than “VerifyProcessStep1”
- Label decision branches clearly: Use guard conditions like [eligible], [not eligible]
- Minimize crossing arrows: Keep flow clean and left-to-right or top-to-bottom
- Group related actions: Use swimlanes or notes to clarify roles if needed
Tools to Draw Activity Diagrams
- StarUML: Easy-to-use drag and drop editor with UML 2.x support
- Lucidchart: Great for collaborative flow visualization
- PlantUML: Text-based diagram generator, perfect for version control
- draw.io: Free and intuitive tool for quick flow modeling
PlantUML Example
@startuml
start
:Login;
if (Is Eligible?) then (yes)
:Select Subjects;
:Submit Registration;
else (no)
:Show Not Eligible Message;
endif
stop
@enduml

Conclusion
Activity Diagrams are an excellent way to visualize the internal flow of a system. They complement use case diagrams by offering depth — showing what actually happens during each process. Whether you're designing a student registration workflow or planning logic for a grading system, activity diagrams help everyone — from developers to testers to stakeholders — see the big picture in motion.
Up next, we’ll take a look at Sequence Diagrams, which focus not on what happens but on who interacts with whom and when — bringing timelines into the picture.
QUIZ
Question 1:What does an Activity Diagram primarily represent in UML?
Question 2:Activity Diagrams can represent both sequential and parallel behavior.
Question 3:Which of the following elements are typically found in Activity Diagrams?
Question 4:Consider a school exam process: 'Distribute papers → Collect responses → Evaluate answers'. What UML tool best models this?
Question 5:In an Activity Diagram, a Fork Node indicates the end of a parallel flow.
Question 6:In which scenarios are Activity Diagrams especially useful?
Question 7:What does a filled circle followed by an arrow typically indicate in an Activity Diagram?
Question 8:Actions and activities can be used interchangeably in UML Activity Diagrams.
Question 9:What are the characteristics of a Decision Node in an Activity Diagram?
Question 10:Given this scenario:
// Student completes homework
// Teacher reviews it and gives feedback
// Feedback may lead to rework or approval
Which element would best represent 'rework or approval' flow in an Activity Diagram?
// Student completes homework
// Teacher reviews it and gives feedback
// Feedback may lead to rework or approval