how many methods are there in class runnable?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tanmay Kadam
    New Member
    • Dec 2010
    • 1

    how many methods are there in class runnable?

    how many methods are there in class runnable?
  • Oralloy
    Recognized Expert Contributor
    • Jun 2010
    • 988

    #2
    Tanmay Kadam,

    What do you mean?

    You can go to the JavaDoc and count class-specific methods.

    You can recursively walk the class tree and get all inherited methods.

    Neither method gives you the hidden, compiler-generated methods, though.

    Likely the easiest method for you to count the methods is to use the reflection facilities. (see the java.lang.refle ct package)

    Try starting with:
    Code:
    java.lang.Runnable.class.getMethods()

    Cheers!
    Oralloy
    Last edited by Oralloy; Dec 1 '10, 04:53 PM. Reason: Removed erroneous salutation

    Comment

    • Sean Pedersen
      New Member
      • Dec 2010
      • 30

      #3
      The only overloaded method is run(). Overloading that method is required to start a new Thread with Runnable. The other I know about is start(). When called it executes your run() method in the new Thread object.
      Last edited by Sean Pedersen; Dec 6 '10, 03:41 AM. Reason: added hyperlink

      Comment

      Working...