Kenya Class Types

Kenya has built in one main class type, String. A String is used to represent a sequence of characters, and as such you may write a sequence of characters (including the escape sequences above) for a string directly in your source code, between quote (") marks.

Class Types can also be user defined, the syntax for doing this is:

	class class_name {
		class_variable_declaration = default_value;

A more grounded example would be a class to store an X,Y co-ordinate, that defaults at 10,3.

Example 2.1. Class Type Example

	void main(){
		//here we create a new Coordinate object.
		Coordinate c;

		//here we change the values of the variables 
		// the Coordinate object holds.		
		c.x = 3;
		c.y = 2;
	void printCoordinate( Coordinate c ){
		println( c.x + " " + c.y );
	class Coordinate {
		int x = 0;
		int y = 3;

All Class types may also be assigned to the special value null (which is also the Class Type's default value when they are initialised in arrays or as elements of other classes). The literal null may therefore be written directly in your source code in conditionals, assignments, etc.

Note, Class Types in Kenya are fairly restrictive compared to those in Java. Mainly they cannot extend each other in a Type Heirarchy, and they cannot contain methods.