Draw on the right, write (Umple) model code on the left. Analyse models and generate code. This tool stores your data in cookies and on a server. I understand. Click to learn about privacy. Download Donate For help: User manual Ask questions Report issue
/* * Introductory example of Umple showing classes, * attribute, association, generalization, methods * and the mixin capability. Generate java and run this. * * The output will be: * The mentor of Tom The Student is Nick The Mentor * The students of Nick The Mentor are [Tom The Student] */ class Person { name; // Attribute, string by default String toString () Java { return(getName()); } String __str__ () Python { return self.getName() } } class Student { isA Person; } class Mentor { isA Person; } association { 0..1 Mentor -- * Student; } class Person { // Notice that we are defining more contents for Person // This uses Umple's mixin capability public static void main(String [ ] args) Java { Mentor m = new Mentor("Nick The Mentor"); Student s = new Student("Tom The Student"); s.setMentor(m); System.out.println("The mentor of " + s + " is " + s.getMentor()); System.out.println("The students of " + m + " are " + m.getStudents()); } public static void main(String [ ] args) Python { import Mentor import Student m = Mentor.Mentor("Nick The Mentor") s = Student.Student("Tom The Student") s.setMentor(m) print("The mentor of " + str(s) + " is " + str(s.getMentor())) print("The students of " + str(m) + " are " + str(m.getStudents())) } }//$?[End_of_model]$? class Person { position 154 29 109 60; } class Mentor { position 253 130 109 45; } //$?[End_of_model]$? // @@@skipcppcompile - Contains Java code // @@@skipphpcompile - Contains Java code // @@@skiprubycompile - Contains Java code // @@@skippythoncompile - Contains Java Code