Declaration and Instantiation (Java/C++/C# Style)

A declaration-instantiation statement is used to create a Jeroo object. The declaration-instantiation statements must appear in the main method before any other statements.

A declaration-instantiation statement has the form
   Jeroo identifier = new Jeroo( arguments );
There are six constructors as shown in the following table.

Example

Attributes

Jeroo Kim = new Jeroo();


Accept default attributes
Name: Kim
Location: (0,0)
Direction: EAST
Flowers: 0
Jeroo Kim = new Jeroo(8);


Specify the flowers
Name: Kim
Location: (0,0)
Direction: EAST
Flowers: 8
Jeroo Kim = new Jeroo(3,4);


Specify the location
Name: Kim
Location: (3,4)
Direction: EAST
Flowers: 0
Jeroo Kim = new Jeroo(3,4,WEST);


Specify location and direction
Name: Kim
Location: (3,4)
Direction: WEST
Flowers: 0
Jeroo Kim = new Jeroo(3,4,8);


Specify location and flowers
Name: Kim
Location: (3,4)
Direction: EAST
Flowers: 8
Jeroo Kim = new Jeroo(3,4,SOUTH,8);


Specify all attributes
Name: Kim
Location: (3,4)
Direction: SOUTH
Flowers: 8