why wont this method work?

Discussion in 'Java' started by Rookie, Aug 30, 2003.

  1. Rookie

    Rookie Guest

    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.
     
    Rookie, Aug 30, 2003
    #1
    1. Advertisements

  2. Rookie wrote:
    >
    > 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.

    --
    Lee Fesperman, FirstSQL, Inc. (http://www.firstsql.com)
    ==============================================================
    * The Ultimate DBMS is here!
    * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com)
     
    Lee Fesperman, Aug 30, 2003
    #2
    1. Advertisements

  3. Rookie

    Benny Guest

    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

    "Rookie" <> wrote in message news:<>...
    > 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.
     
    Benny, Aug 30, 2003
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ß Ø ® G
    Replies:
    8
    Views:
    540
    ß Ø ® G
    Oct 6, 2003
  2. Horace Nunley

    why why why does function not work

    Horace Nunley, Sep 27, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    697
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Sep 27, 2006
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    1,347
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,798
    Smokey Grindel
    Dec 2, 2006
  5. =?Utf-8?B?cm9kY2hhcg==?=

    why wont this dang thing work...

    =?Utf-8?B?cm9kY2hhcg==?=, Mar 8, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    431
    =?Utf-8?B?cm9kY2hhcg==?=
    Mar 8, 2007
  6. Milsnips
    Replies:
    4
    Views:
    541
    Juan T. Llibre
    Apr 3, 2007
  7. Graham Mattingley

    why wont this work ?

    Graham Mattingley, Jan 22, 2004, in forum: ASP General
    Replies:
    2
    Views:
    634
  8. Ali

    Why wont this script work?

    Ali, Sep 30, 2004, in forum: Javascript
    Replies:
    12
    Views:
    248
    Michael Winter
    Oct 18, 2004
Loading...