Introduction to Java Class Diagrams. Classes class Account { … } Account.

Slides:



Advertisements
Similar presentations
Introduction to classes Sangeetha Parthasarathy 06/11/2001.
Advertisements

Software Engineering Implementation Lecture 3 ASPI8-4 Anders P. Ravn, Feb 2004.
INTERFACES IN JAVA 1.Java Does not support Multiple Inheritance directly. Multiple inheritance can be achieved in java by the use of interfaces. 2.We need.
Department of computer science N. Harika. Inheritance Inheritance is a fundamental Object Oriented concept A class can be defined as a "subclass" of another.
Introduction to Object-Oriented Programming CS 21a: Introduction to Computing I First Semester,
Inheritance The objectives of this chapter are: To explore the concept and implications of inheritance Polymorphism To define the syntax of inheritance.
UML – Class Diagrams.
Unit 4II 1 More about classes H Defining classes revisited H Constructors H Defining methods and passing parameters H Visibility modifiers and encapsulation.
1. 2 Introduction to Classes  Motivation  Class Components  Instance Variables  Constructors  The Student Class  Exercises.
ECE122 L6: Problem Definition and Implementation February 15, 2007 ECE 122 Engineering Problem Solving with Java Lecture 6 Problem Definition and Implementation.
UML-diagrams Unified Modelling Language Used for Classes Objects.
UML a crash course Alex Lo Brian Kiefer. Overview Classes Class Relationships Interfaces Objects States Worksheet.
Chapter 10: Inheritance 1. Inheritance  Inheritance allows a software developer to derive a new class from an existing one  The existing class is called.
Class Diagram.
Java Language and SW Dev’t
Object-Oriented Programming in C++
UML Review – class diagrams SE 2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.
ACO 101: Introduction to Computer Science Anatomy Part 2: Methods.
Chapter 4 Procedural Methods. Learning Java through Alice © Daly and Wrigley Objectives Identify classes, objects, and methods. Identify the difference.
Inheritance CSC 171 FALL 2004 LECTURE 18. READING Read Horstmann, Chapter 11.
بسم الله الرحمن الرحيم ” اللهم أنت ربي لا إله إلا أنت خلقتني و أنا عبدك وأنا على عهدك ووعدك ما استطعت ، أعوذ بك من شر ما صنعت ، أبوء لك بنعمتك على و أبوء.
Chapter 4: A Paradigm Program structure Connecting to the Java world Types Access modifiers Lifetime modifiers.
UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, They may not be rehosted, sold, or modified without expressed permission.
Java The Java programming language was created by Sun Microsystems, Inc. It was introduced in 1995 and it's popularity has grown quickly since A programming.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA ‏ Visibility Control.
Information Systems Engineering
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
Introduction to Java Java Translation Program Structure
Programs and Classes A program is made up from classes Classes may be grouped into packages A class has two parts static parts exist independently Non-static.
Concurrency Control 1 Fall 2014 CS7020: Game Design and Development.
Rina System development with Java Instructors: Rina Zviel-Girshin Lecture 4.
Problem 1 Bank.  Manage customers’ bank account using the following operations: Create a new account given a customer’s name and initial account. Deposit.
Class diagrams Terézia Mézešová.
Bank Account Example public class BankAccount { private double balance; public static int totalAccounts = 0; public BankAccount() { balance = 0; totalAccounts++;
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
COM S 228 Introduction to Data Structures Instructor: Ying Cai Department of Computer Science Iowa State University Office: Atanasoff.
Inheritance and Subclasses CS 21a. 6/28/2004 Copyright 2004, by the authors of these slides, and Ateneo de Manila University. All rights reserved L16:
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Classes in C++ And comparison to Java CS-1030 Dr. Mark L. Hornick.
Access Specifier. Anything declared public can be accessed from anywhere. Anything declared private cannot be seen outside of its class. When a member.
Class Everything in Java is in a class. The class has a constructor that creates the object. If you do not supply a constructor Java will create a default.
CS 100Lecture71 CS100J Lecture 7 n Previous Lecture –Computation and computational power –Abstraction –Classes, Objects, and Methods –References and aliases.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
Class Diagrams Revisited. Parameterized Classes Parameterized Classes - are used to represent relationships between templates.
COMPUTER SCIENCE & TECHNOLOGY DEGREE PROGRAMME FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UVA WELLASSA ‏ Properties of Object Oriented Programming.
Copyright Jason Gorman UML for.NET Developers Class Diagrams.
1 Chapter 5 Implementing UML Specification (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence.
UML Review – class diagrams SE-2030 Dr. Mark L. Hornick 1.
 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
COP 3330 Notes 4/13. Today’s Topics UML Class Diagrams.
Packages, Interfaces & Exception Handling
Software Engineering System Modeling Chapter 5 (Part 2) Dr.Doaa Sami
Software Engineering System Modeling Chapter 5 (Part 2) Dr.Doaa Sami
Class Diagram Details CS 124.
Chapter 4 Procedural Methods.
CSC 205 Java Programming II
Object Oriented Analysis and Design
The Basics of Class Diagrams for a single class
ניתוח מערכות מידע א' הרצאה 3
null, true, and false are also reserved.
An Introduction to Java – Part II
Software Engineering System Modeling Extra examples Dr.Doaa Sami
Implementing Classes Chapter 3.
Chapter 7 Procedural Methods.
JAVA CLASSES.
By Rajanikanth B OOP Concepts By Rajanikanth B
Class Diagram.
Introduction to Object-Oriented Concepts in Java
By Rajanikanth B Classes in Java By Rajanikanth B
The generalization of class
Presentation transcript:

Introduction to Java Class Diagrams

Classes class Account { … } Account

Attributes class Account { float balance = 0; float limit; } Account balance: float = 0 limit: float [visibility] attributeName [multiplicity] [: type [ = initialValue ] ]

Visibility class Account { private float balance = 0; private float limit; } Account - balance: float = 0 - limit: float + public - private # protected ~ package

Operations (methods) class Account { private float balance = 0; private float limit; public void deposit(float amount) public void withdraw(float amount) } Account - balance: float = 0 - limit: float [visibility] methodName( [parameter: type]* ) [ : returnType] + deposit( amount: float ) + withdraw( amount: float )

Class scope class Person { private static int numPeople; private String name; public String getName() public static int getNumPeople() } Person - numPeople: int - name: String + getName() : String + getNumPeople() : int

Composition A comprises local objects that die when A dies class Basket { Item item = new Item(); } BasketItem

Aggregation comprised of sharable objects class Computer { Device dev; Computer(Device dev) { this.dev = dev; } ComputerDevice

Multiplicities class Basket { Item item = new Item(); } BasketItem 1

Multiplicities class Basket { Item[] item = new Item[5]; } BasketItem 5

Multiplicities class Basket { // may or may not exist Item item; } BasketItem 0..1 i..j means i <= # objects <= j

Multiplicities class Basket { List itemList = newArrayList (); } BasketItem 0..* * means no a priori upper limit

Generalization (is a) class Person { … } class Employee extends Person { … } Person Employee

Realization interface Person { … } class Employee implements Person { … } Person Employee Person