why wont this method work?

R

Rookie

Why can I not do this?

initialise();

from a diffrent class that is it the same directory as

public static int ticker;

public static void initialise()
{
ticker=0;
}
which is in its own class.
 
L

Lee Fesperman

Rookie said:
Why can I not do this?

initialise();

from a diffrent class that is it the same directory as

public static int ticker;

public static void initialise()
{
ticker=0;
}
which is in its own class.

You have to tell the compiler which class the method is in. There could be several
classes with an initialise() method.
 
B

Benny

Hello,

If you really want to invoke the static method from other class.
Then you have to call that method by ClassName.methodname(). The way
that you mentioned is valid with the same class only. Hope this can
help you.

Benny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top