UML is used in modelling and design phase of an application. The purpose of these language is to write better and efficient code. UML helps in visualizing the system before the coding process starts. By doing this, a lot of bugs can be avoided at later stage which results in saving the maintenance cost.

In a Java interview, if you are asked about UML and have worked on it in your earlier projects then do speak about your experience in using UML. The most common type of diagrams are use case diagrams, class diagrams and sequence diagrams. While use case diagrams are used to depict a particular business scenario, the class diagrams are used to represent the structure of a class and sequence diagrams are used show the relationship between various classes and more importantly the logical flow between them.

Class diagram

As mentioned above, the class diagram used to show the member variables and methods of a class. Additionally, the class diagram shows the relationship between various classes. These relationships include inheritance, composition, association and aggregation etc.

This diagram contains static data about a class which includes the access modifier, constructors and type (interface, abstract class or concrete class).

A class diagram looks like:

class diagram

Sequence diagram

A sequence diagram is a dynamic message sequence chart which shows the interaction between various classes and the messages being exchanged with respect to time. While the classes are arranged vertically, the messages are shown as horizontal arrows. Sometimes the messages are numbered to help identify the sequence in which they are invoked.

In addition to the classes of application, the users are also shown in the sequence diagram. These diagrams are very effective way of showing how a particular sub-system behaves.

A sequence diagram looks like:

UML sequence diagram

UML class and sequence diagram example in Java admin Core Java
UML is used in modelling and design phase of an application. The purpose of these language is to write better and efficient code. UML helps in visualizing the system before the coding process starts. By doing this, a lot of bugs can be avoided at later stage which results...
UML is used in modelling and design phase of an application. The purpose of these language is to write better and efficient code. UML helps in visualizing the system before the coding process starts. By doing this, a lot of bugs can be avoided at later stage which results in saving the maintenance cost. In a Java interview, if you are asked about UML and have worked on it in your earlier projects then do speak about your experience in using UML. The most common type of diagrams are use case diagrams, class diagrams and sequence diagrams. While use case diagrams are used to depict a particular business scenario, the class diagrams are used to represent the structure of a class and sequence diagrams are used show the relationship between various classes and more importantly the logical flow between them. <h2>Class diagram</h2> As mentioned above, the class diagram used to show the member variables and methods of a class. Additionally, the class diagram shows the relationship between various classes. These relationships include inheritance, composition, association and aggregation etc. This diagram contains static data about a class which includes the access modifier, constructors and type (interface, abstract class or concrete class). A class diagram looks like: <img src="http://www.javaexperience.com/wp-content/uploads/2012/12/class_diagram-e1356674289624.png" alt="class diagram" width="600" height="607" class="alignnone size-full wp-image-2060" /> <h2>Sequence diagram</h2> A sequence diagram is a dynamic message sequence chart which shows the interaction between various classes and the messages being exchanged with respect to time. While the classes are arranged vertically, the messages are shown as horizontal arrows. Sometimes the messages are numbered to help identify the sequence in which they are invoked. In addition to the classes of application, the users are also shown in the sequence diagram. These diagrams are very effective way of showing how a particular sub-system behaves. A sequence diagram looks like: <img src="http://www.javaexperience.com/wp-content/uploads/2012/12/sequence-diagram-e1356674160614.gif" alt="UML sequence diagram" width="600" height="368" class="alignnone size-full wp-image-2061" />
The following two tabs change content below.
I run this blog with lots of passion. In this website, you will find tutorials on Core Java, Spring, Struts, Web Applications, Portals and Database. Please support me and the website by sharing the posts on your facebook / twitter. You can tap the share button at the top of each post. Thanks for the support.