list of dots

User Manual    [Previous]   [Next]   

Namespace Directives

Namespaces allow you to group similar entities to promote cohesion, as well as reduce the possibility of name collision. Sub-namespaces are separated using a period (.).

In the following example, the classes Faculty and Student will be in namespace school.admin. In Java they will be generated into the admin package (directory) within the school package. Similarly, class Building will be in the elevator.structure namespace.


namespace school.admin;

class Faculty{}
class Student{}

namespace elevator.structure;

class Building
  1 -- * Classroom;

class Classroom{}

Load the above code into UmpleOnline



// Namespaces divide the code into logical groups. See NamespaceDirectives
namespace- : namespace [namespace] ;