calling static functions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashuMBI06
    New Member
    • Jun 2007
    • 1

    calling static functions

    Hi!
    Can any of u tell me how to access a static function defined in a biojava package from a non-static function such as actionperformed () of interface ActionListener?
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    Originally posted by ashuMBI06
    Hi!
    Can any of u tell me how to access a static function defined in a biojava package from a non-static function such as actionperformed () of interface ActionListener?
    Welcome to TSDN.

    U can as it is done.
    A static method can be called from a non-static method.
    But vice versa is not possible.

    Kind regards,
    Dmjpro.

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by ashuMBI06
      Hi!
      Can any of u tell me how to access a static function defined in a biojava package from a non-static function such as actionperformed () of interface ActionListener?
      Use the class name. If the class is called A and has a static method called method, you can call it using A.method

      Comment

      • KishoreM
        New Member
        • Jun 2007
        • 12

        #4
        Originally posted by ashuMBI06
        Hi!
        Can any of u tell me how to access a static function defined in a biojava package from a non-static function such as actionperformed () of interface ActionListener?
        Hi,
        you can call any static function(method ) from a non-static function however you can not call a non-static function from a static function.

        regards,

        Kishore M

        Comment

        Working...