A ClassDefinition 's Block is evaluated just like any other Block , so it can contain expressions, statements, loops, etc. Such statements that do not contain declarations do not contribute members to the class being declared, but they are evaluated when the class is declared. If a ClassDefinition omits the class name Identifier , it extends the original class rather than creating a subclass. A class extension may not override methods, and it may not define constructors or instance variables. Each instance of the original class is automatically also an instance of the extended class.
Several extensions can apply to the same class.
There is no possibility of name clashes with extensions of class string in other, unrelated packages because the names scramble and unscramble belong to package P and not the system package that defines string . Any packages that import package P will also be able to call scramble and unscramble on strings, but other packages will not. Members A class has an associated set of class members and another set of instance members . Class members are properties of the class itself, while instance members are properties of each instance object of this class and have independent values for different instance objects. Constants declared with the const keyword.