Top Topics in our Forum';
Interactive Parabola Grapher
Explore graph ,equation and the locus of a Parabola
Save graphs to your desktop!

A+    A−    B  
Algebra
Games
Geometry
Interactive
Trigonometry
Forum



Warning: include(/home/mathwa6/public_html/php_include/forum_left_side.php) [function.include]: failed to open stream: No such file or directory in /home/mathwa6/public_html/php_include/ontheLeft_moris.php on line 296

Warning: include() [function.include]: Failed opening '/home/mathwa6/public_html/php_include/forum_left_side.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mathwa6/public_html/php_include/ontheLeft_moris.php on line 296


AddThis Social Bookmark Button

Jeroo : Overloading Constructors

How to Declare & Instantiate

Jeroo: How to Instantiate and Construct a Jeroo

   
  

Constructing a new Jeroo


Jeroos do not exist until you say so. To create a Jeroo, you have to declare the Jeroo, and then instantiate the Jeroo. Declaration means that you give the Jeroo a name. Instantiation means that you give the Jeroo some character traits, such as starting position, the direction she faces, or how many flowers she has. For example,

'Overloading' Constructors by number of paramaters

    Constructors Number of Parameters
    Jeroo jack = new Jeroo() 0
    Jeroo jill = new Jeroo(0,1) 2
    Jeroo jimmy = new Jeroo(1,5,NORTH) 3
    Jeroo jane = new Jeroo(2,7,WEST,10); 4
There are actually four different ways that you can instantiate a Jeroo. To use Java diction, the constructor for a Jeroo is overloaded. For our purposes, overloading just means that the constructor (when you call 'new Jeroo()') takes a different number of parameters.
'Overloading' Constructors by 'datatype' of paramaters


The second way that you can 'overload' constructors is by using the same number of paramaters BUT by having the paramters be of a different datatype.

`
Constructors Datatype of Parameters
Jeroo jill = new Jeroo(0,1,NORTH) (number,number, direction)
Jeroo Jason = new Jeroo(2,3,6) (number,number,number)