Re: Could some body help please ?

"Cosmin Dancu" <[email protected]> Mon, 06 Sep 2004 11:55:17 -0000
Newsgroups gmane.comp.cybernetics.webot.contest
Message-ID <[email protected]>
Hi,

The statement below creates an array of arrays and *not* the 
NormalDistribution objects. 

>           Probs= new NormalDistribution[11][94];

All references in Probs array are null and improper use will cause a 
NullPointerException.

In order to initialize the array you have to create the objects like 
this:

  NormalDistribution[][] Probs;
  Probs = new NormalDistribution[11][94];
  for(int i = 0; i < 11; ++i) {
    for(int j = 0; j < 94; ++j) {
      Probs[i][j] = new NormalDistribution();
    }
  }

Cosmin.

--- In [email protected], "joseoomartin" 
<joseamartin@c...> wrote:
> I am using the library Jsci.
> 
> there is a class NormalDistribution.
> 
> but if i try to initialize the size of the array, webots aborts the
> robot controller with out any possibility of reading any error.
> 
> I have proved this class outside webots and this instruction works 
well
> 
>           Probs= new NormalDistribution[11][94];
> 
> but if i write this intruction on webots, the robot controller is
> aborted, and no chance of catching any expeption is possible.
> 
> Could some body help ?...
> 
> Thanks...



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/pU_rlB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/webots-contest/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/