Help with public variables

Hey, I thought I could make a public variable and then have multiple lower level functions modify this variable. Is that not correct? What am I doing wrong, any help would be greatly appreciated. Thanks!

public class testapp extends Applet implements MouseListener {

*declare a bunch of public arrays*

public void math() {

*do a bunch of math*

}

public void map(graphics){

*graphics*

}}

at the end it just outputs 0 for all those variables.

are those functions even working?

Re: Help with public variables

Its kinda hard to say, but I dont see the functions math(), or map() called from anywhere, so the integer variables could simply be outputting their defualt 0 value

...Try to use code tags when you post code.

Re: Help with public variables

Ya, I was playing around with that.

public void main(Graphics g){

math(g);

map(g);

}

I am not sure that is working though

Thanks

Re: Help with public variables

The mapping function is certainly working... its outputting the right variables in the right places, all the variables are simply 0.

Either the math function isnt running or the variables are not being passed back and forth properly. Help!

Re: Help with public variables

try doing this:

Code:

`public class testapp extends Applet implements MouseListener {`

*declare a bunch of public arrays*

public void start() {

math();

map();

}

public void math() {

*do a bunch of math*

}

public void map(graphics g){

*graphics*

}

}

Re: Help with public variables

It worked! Map runs without the start thing, but math does not.

Thanks!

Re: Help with public variables

No problem, You're the first i've helped on this forum!