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 __str__() { 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) { 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(list(map(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 Python code // @@@skipphpcompile - Contains Python code // @@@skiprubycompile - Contains Python code // @@@skipjavacompile - Contains Python Code // @@@skippythoncompile - quires Python 3, Current CLI uses Python 2.7