Video of Day

UML - Class Diagram example

Now  I am going to show you a example  on class diagram

see the following java code


 public class CrazyCoder {  
      public int num1;  
      public int num2;  
      public int add(){  
           return num1+num2;  
      }  
      public int sub(){  
           return num1-num2;  
      }  
      public int mul(){  
           return num1*num2;  
      }  
      public int div(){  
           return num1/num2;  
      }  
 }  


What will be the class diagram of this code???

Let's solve it

At first you have to follow the Rules

in the diagram the 1st part will contain  class name

2nd part will contain it's properties/variables

and 3rd part will contain the methods



See also UML in java
Happy coding :)

Share on Google Plus

About Admin

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment