SlideShare a Scribd company logo
1 of 3
Introduction to Java 2 Programming Handout umlexamples-140612092848-phpapp02.doc
L.Dodds, October 2002 1/3
UML Class Diagrams and Examples
Here are some examples of UML class diagrams and explanations of their contents. See
if you can interpret the last diagram yourself. Refer to Handout #2 for help with the UML
syntax.
Example #1: Inheritance – Vehicles
This diagram shows an inheritance hierarchy – a series of classes and their subclasses. Its
for an imaginary application that must model different kinds of vehicles such as bicycles,
motor bike and cars.
Notes
 All Vehicles have some common attributes (speed and colour) and common
behaviour (turnLeft, turnRight)
 Bicycle and MotorVehicle are both kinds of Vehicle and are therefore shown to
inherit from Vehicle. To put this another way, Vehicle is the superclass of both
Bicycle and MotorVehicle
Introduction to Java 2 Programming Handout umlexamples-140612092848-phpapp02.doc
L.Dodds, October 2002 2/3
 In our model MotorVehicles have engines and license plates. Attributes have been
added accordingly, along with some behaviour that allows us to examine those
attributes
 MotorVehicles is the base class of both MotorBike and Car, therefore these
classes not only inherit the speed and colour properties from Vehicle, but also the
additional attributes and behaviour from MotorVehicle
 Both MotorBike and Car have additional attributes and behaviour which
arespecific to those kinds of object.
Example #2: Relationships – Students and Courses
This example demonstrates relationships between classes. It’s from an imaginary
application that models university courses.
Notes
 Each Course object maintains a list of the students on that course and the lecturer
who has been assigned to teach that course
Introduction to Java 2 Programming Handout umlexamples-140612092848-phpapp02.doc
L.Dodds, October 2002 3/3
 The Course object has behaviour that allow the adding and removing of students
from the course, assigning a teacher, getting a list of the currently assigned
students, and the currently assigned teacher.
 Teachers are modelled as Lecturer objects. As a lecturer may teach more than one
course there is an association between Course and Lecturer. The “taughtBy”
relationship shows that a Course only has a single teacher, but that a lecturer may
teach several Courses.
 Each Lecturer object also maintains a list of the Courses that it teaches.
 There is a similar relationship between Course and Student. A course is attended
by zero or more Students, and a Student may attend multiple courses.
This example also demonstrates the use of interfaces. The diagram shows a Person
interface that stipulates that objects conforming to this interface will have a getName and
getEmailAddress methods. Both Lecturer and Student are shown to be types of Person.
Example #3: Mixed Example – Company, Employee, Manager
This example is from a system that models companies, e.g. for a payroll or reporting
system. See if you can interpret it yourself!

More Related Content

Viewers also liked

Tugas ICT "peranan
Tugas ICT "perananTugas ICT "peranan
Tugas ICT "perananhsbpamungkas
 
Ch14.3 ch15
Ch14.3 ch15Ch14.3 ch15
Ch14.3 ch15grieffel
 
4. class diagrams using uml
4. class diagrams using uml4. class diagrams using uml
4. class diagrams using umlAPU
 
Discrimination and atrocities against scheduled castes in india a historical...
Discrimination and atrocities against scheduled castes in india  a historical...Discrimination and atrocities against scheduled castes in india  a historical...
Discrimination and atrocities against scheduled castes in india a historical...Devidas Shambharkar
 
Ambedkar - Life and Contribution
Ambedkar - Life and ContributionAmbedkar - Life and Contribution
Ambedkar - Life and ContributionRamesh Rengasamy
 
The Caste System of Ancient India
The Caste System of Ancient IndiaThe Caste System of Ancient India
The Caste System of Ancient Indiadouglmeg
 
Schedule caste and schedule tribes
Schedule caste and schedule tribesSchedule caste and schedule tribes
Schedule caste and schedule tribesManasi Mishra
 
Caste system
Caste systemCaste system
Caste systemrahul1250
 
Caste System PPT
Caste System PPTCaste System PPT
Caste System PPTdanigrose
 

Viewers also liked (13)

Tugas ICT "peranan
Tugas ICT "perananTugas ICT "peranan
Tugas ICT "peranan
 
Ch14.3 ch15
Ch14.3 ch15Ch14.3 ch15
Ch14.3 ch15
 
Presentation 3.1
Presentation 3.1Presentation 3.1
Presentation 3.1
 
4. class diagrams using uml
4. class diagrams using uml4. class diagrams using uml
4. class diagrams using uml
 
Uml
UmlUml
Uml
 
Hospital management
Hospital managementHospital management
Hospital management
 
Discrimination and atrocities against scheduled castes in india a historical...
Discrimination and atrocities against scheduled castes in india  a historical...Discrimination and atrocities against scheduled castes in india  a historical...
Discrimination and atrocities against scheduled castes in india a historical...
 
Ambedkar - Life and Contribution
Ambedkar - Life and ContributionAmbedkar - Life and Contribution
Ambedkar - Life and Contribution
 
The Caste System of Ancient India
The Caste System of Ancient IndiaThe Caste System of Ancient India
The Caste System of Ancient India
 
Schedule caste and schedule tribes
Schedule caste and schedule tribesSchedule caste and schedule tribes
Schedule caste and schedule tribes
 
Caste system
Caste systemCaste system
Caste system
 
Caste System PPT
Caste System PPTCaste System PPT
Caste System PPT
 
Class diagrams
Class diagramsClass diagrams
Class diagrams
 

Similar to Java Programming UML Class Diagrams

Chapter 4: Enhanced Entity-Relationship and Object Modeling
Chapter 4:  Enhanced Entity-Relationship and Object ModelingChapter 4:  Enhanced Entity-Relationship and Object Modeling
Chapter 4: Enhanced Entity-Relationship and Object ModelingRaj vardhan
 
Object Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UMLObject Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UMLMalek Sumaiya
 
Introduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdfIntroduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdfTARGARYEN001
 
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...Aravind NC
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering Madhar Khan Pathan
 
Ooad notes
Ooad notesOoad notes
Ooad notesNancyJP
 
Exact implementation of design patterns in
Exact implementation of design patterns inExact implementation of design patterns in
Exact implementation of design patterns inijait
 
CS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT IICS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT IIpkaviya
 
Uml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot netUml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot netmekhap
 
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda TrainingsSAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda TrainingsGaruda Trainings
 
Diagramming the Class Diagram: Toward a Unified Modeling Methodology
Diagramming the Class Diagram: Toward a Unified Modeling Methodology Diagramming the Class Diagram: Toward a Unified Modeling Methodology
Diagramming the Class Diagram: Toward a Unified Modeling Methodology IJCSIS Research Publications
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web designsmumbahelp
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web designsmumbahelp
 
Java OOPS Concept
Java OOPS ConceptJava OOPS Concept
Java OOPS ConceptRicha Gupta
 
UNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxUNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxanguraju1
 

Similar to Java Programming UML Class Diagrams (20)

Chapter 4: Enhanced Entity-Relationship and Object Modeling
Chapter 4:  Enhanced Entity-Relationship and Object ModelingChapter 4:  Enhanced Entity-Relationship and Object Modeling
Chapter 4: Enhanced Entity-Relationship and Object Modeling
 
Object Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UMLObject Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UML
 
Introduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdfIntroduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdf
 
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
Ooad notes
Ooad notesOoad notes
Ooad notes
 
Exact implementation of design patterns in
Exact implementation of design patterns inExact implementation of design patterns in
Exact implementation of design patterns in
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
 
Oops
OopsOops
Oops
 
CS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT IICS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT II
 
Sda 7
Sda   7Sda   7
Sda 7
 
Uml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot netUml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot net
 
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda TrainingsSAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
 
Lect1
Lect1Lect1
Lect1
 
Diagramming the Class Diagram: Toward a Unified Modeling Methodology
Diagramming the Class Diagram: Toward a Unified Modeling Methodology Diagramming the Class Diagram: Toward a Unified Modeling Methodology
Diagramming the Class Diagram: Toward a Unified Modeling Methodology
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web design
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web design
 
Java OOPS Concept
Java OOPS ConceptJava OOPS Concept
Java OOPS Concept
 
Software Testing and UML Lab
Software Testing and UML LabSoftware Testing and UML Lab
Software Testing and UML Lab
 
UNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxUNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptx
 

More from Amit Gandhi

More from Amit Gandhi (20)

Job portal
Job portalJob portal
Job portal
 
Dimond recognition system
Dimond recognition systemDimond recognition system
Dimond recognition system
 
Project Report
Project ReportProject Report
Project Report
 
Project Report
Project ReportProject Report
Project Report
 
Software requirement specification
Software requirement specificationSoftware requirement specification
Software requirement specification
 
Student management system
Student management systemStudent management system
Student management system
 
Student Management System
Student Management SystemStudent Management System
Student Management System
 
Student Management System
Student Management SystemStudent Management System
Student Management System
 
Student Management System
Student Management SystemStudent Management System
Student Management System
 
List of tables
List of tablesList of tables
List of tables
 
List of figures
List of figuresList of figures
List of figures
 
Company profile
Company profileCompany profile
Company profile
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Chapter 8
Chapter 8Chapter 8
Chapter 8
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 

Recently uploaded

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 

Recently uploaded (20)

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 

Java Programming UML Class Diagrams

  • 1. Introduction to Java 2 Programming Handout umlexamples-140612092848-phpapp02.doc L.Dodds, October 2002 1/3 UML Class Diagrams and Examples Here are some examples of UML class diagrams and explanations of their contents. See if you can interpret the last diagram yourself. Refer to Handout #2 for help with the UML syntax. Example #1: Inheritance – Vehicles This diagram shows an inheritance hierarchy – a series of classes and their subclasses. Its for an imaginary application that must model different kinds of vehicles such as bicycles, motor bike and cars. Notes  All Vehicles have some common attributes (speed and colour) and common behaviour (turnLeft, turnRight)  Bicycle and MotorVehicle are both kinds of Vehicle and are therefore shown to inherit from Vehicle. To put this another way, Vehicle is the superclass of both Bicycle and MotorVehicle
  • 2. Introduction to Java 2 Programming Handout umlexamples-140612092848-phpapp02.doc L.Dodds, October 2002 2/3  In our model MotorVehicles have engines and license plates. Attributes have been added accordingly, along with some behaviour that allows us to examine those attributes  MotorVehicles is the base class of both MotorBike and Car, therefore these classes not only inherit the speed and colour properties from Vehicle, but also the additional attributes and behaviour from MotorVehicle  Both MotorBike and Car have additional attributes and behaviour which arespecific to those kinds of object. Example #2: Relationships – Students and Courses This example demonstrates relationships between classes. It’s from an imaginary application that models university courses. Notes  Each Course object maintains a list of the students on that course and the lecturer who has been assigned to teach that course
  • 3. Introduction to Java 2 Programming Handout umlexamples-140612092848-phpapp02.doc L.Dodds, October 2002 3/3  The Course object has behaviour that allow the adding and removing of students from the course, assigning a teacher, getting a list of the currently assigned students, and the currently assigned teacher.  Teachers are modelled as Lecturer objects. As a lecturer may teach more than one course there is an association between Course and Lecturer. The “taughtBy” relationship shows that a Course only has a single teacher, but that a lecturer may teach several Courses.  Each Lecturer object also maintains a list of the Courses that it teaches.  There is a similar relationship between Course and Student. A course is attended by zero or more Students, and a Student may attend multiple courses. This example also demonstrates the use of interfaces. The diagram shows a Person interface that stipulates that objects conforming to this interface will have a getName and getEmailAddress methods. Both Lecturer and Student are shown to be types of Person. Example #3: Mixed Example – Company, Employee, Manager This example is from a system that models companies, e.g. for a payroll or reporting system. See if you can interpret it yourself!